Spaces:
Sleeping
Sleeping
HonestAnnie
commited on
Commit
•
f14ec94
1
Parent(s):
471f612
changed css
Browse files
app.py
CHANGED
@@ -70,9 +70,31 @@ theme = gr.themes.Soft(
|
|
70 |
)
|
71 |
|
72 |
custom_css = """
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
.custom-markdown {
|
74 |
border: 1px solid var(--neutral-200);
|
75 |
-
padding:
|
76 |
border-radius: var(--radius-lg);
|
77 |
background-color: var(--color-background-primary);
|
78 |
margin-bottom: 15px;
|
@@ -81,6 +103,22 @@ custom_css = """
|
|
81 |
margin-bottom: 10px;
|
82 |
line-height: 1.6;
|
83 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
"""
|
85 |
|
86 |
with gr.Blocks(theme=theme, css=custom_css) as demo:
|
@@ -89,7 +127,7 @@ with gr.Blocks(theme=theme, css=custom_css) as demo:
|
|
89 |
author_inp = gr.Dropdown(label="Autoren", choices=authors_list_de, multiselect=True)
|
90 |
inp = gr.Textbox(label="Query", lines=3, placeholder="Wie kann ich gesund leben?; Wie kann ich mich besser konzentrieren?; Was ist der Sinn des Lebens?; ...")
|
91 |
btn = gr.Button("Suchen")
|
92 |
-
loading_indicator = gr.Markdown(visible=False)
|
93 |
results = gr.State()
|
94 |
|
95 |
#def update_authors(database):
|
@@ -113,7 +151,7 @@ with gr.Blocks(theme=theme, css=custom_css) as demo:
|
|
113 |
return results_data, ""
|
114 |
|
115 |
btn.click(
|
116 |
-
fn=lambda: ("
|
117 |
inputs=None,
|
118 |
outputs=[loading_indicator, loading_indicator],
|
119 |
queue=False
|
@@ -126,7 +164,7 @@ with gr.Blocks(theme=theme, css=custom_css) as demo:
|
|
126 |
@gr.render(inputs=[results])
|
127 |
def display_accordion(data):
|
128 |
for query, res in data:
|
129 |
-
with gr.Accordion(query, open=False) as acc:
|
130 |
for result in res:
|
131 |
with gr.Column():
|
132 |
author = str(result.get('author', ''))
|
@@ -149,4 +187,4 @@ with gr.Blocks(theme=theme, css=custom_css) as demo:
|
|
149 |
markdown_contents = f"**{header}**\n\n{text}"
|
150 |
gr.Markdown(value=markdown_contents, elem_classes="custom-markdown")
|
151 |
|
152 |
-
demo.launch()
|
|
|
70 |
)
|
71 |
|
72 |
custom_css = """
|
73 |
+
/* Remove outer padding, margins, and borders */
|
74 |
+
gradio-app,
|
75 |
+
gradio-app > div,
|
76 |
+
gradio-app .gradio-container {
|
77 |
+
padding: 0 !important;
|
78 |
+
margin: 0 !important;
|
79 |
+
border: none !important;
|
80 |
+
}
|
81 |
+
|
82 |
+
/* Remove any potential outlines */
|
83 |
+
gradio-app:focus,
|
84 |
+
gradio-app > div:focus,
|
85 |
+
gradio-app .gradio-container:focus {
|
86 |
+
outline: none !important;
|
87 |
+
}
|
88 |
+
|
89 |
+
/* Ensure full width */
|
90 |
+
gradio-app {
|
91 |
+
width: 100% !important;
|
92 |
+
display: block !important;
|
93 |
+
}
|
94 |
+
|
95 |
.custom-markdown {
|
96 |
border: 1px solid var(--neutral-200);
|
97 |
+
padding: 10px;
|
98 |
border-radius: var(--radius-lg);
|
99 |
background-color: var(--color-background-primary);
|
100 |
margin-bottom: 15px;
|
|
|
103 |
margin-bottom: 10px;
|
104 |
line-height: 1.6;
|
105 |
}
|
106 |
+
|
107 |
+
@media (max-width: 768px) {
|
108 |
+
gradio-app,
|
109 |
+
gradio-app > div,
|
110 |
+
gradio-app .gradio-container {
|
111 |
+
padding-left: 1px !important;
|
112 |
+
padding-right: 1px !important;
|
113 |
+
}
|
114 |
+
.custom-markdown {
|
115 |
+
padding: 5px;
|
116 |
+
}
|
117 |
+
.accordion {
|
118 |
+
margin-left: -10px;
|
119 |
+
margin-right: -10px;
|
120 |
+
}
|
121 |
+
}
|
122 |
"""
|
123 |
|
124 |
with gr.Blocks(theme=theme, css=custom_css) as demo:
|
|
|
127 |
author_inp = gr.Dropdown(label="Autoren", choices=authors_list_de, multiselect=True)
|
128 |
inp = gr.Textbox(label="Query", lines=3, placeholder="Wie kann ich gesund leben?; Wie kann ich mich besser konzentrieren?; Was ist der Sinn des Lebens?; ...")
|
129 |
btn = gr.Button("Suchen")
|
130 |
+
loading_indicator = gr.Markdown(visible=False, elem_id="loading-indicator")
|
131 |
results = gr.State()
|
132 |
|
133 |
#def update_authors(database):
|
|
|
151 |
return results_data, ""
|
152 |
|
153 |
btn.click(
|
154 |
+
fn=lambda: ("", gr.update(visible=True)),
|
155 |
inputs=None,
|
156 |
outputs=[loading_indicator, loading_indicator],
|
157 |
queue=False
|
|
|
164 |
@gr.render(inputs=[results])
|
165 |
def display_accordion(data):
|
166 |
for query, res in data:
|
167 |
+
with gr.Accordion(query, open=False, elem_classes="accordion") as acc:
|
168 |
for result in res:
|
169 |
with gr.Column():
|
170 |
author = str(result.get('author', ''))
|
|
|
187 |
markdown_contents = f"**{header}**\n\n{text}"
|
188 |
gr.Markdown(value=markdown_contents, elem_classes="custom-markdown")
|
189 |
|
190 |
+
demo.launch(inline=False)
|