Spaces:
Sleeping
Sleeping
Allen Park
commited on
Commit
·
2d01a69
1
Parent(s):
8de2cbd
fix(add break above exmaple header & make examples how own row again)
Browse files
app.py
CHANGED
@@ -96,9 +96,8 @@ HEADER = """
|
|
96 |
"""
|
97 |
|
98 |
EXAMPLES_HEADER = """
|
99 |
-
|
100 |
# Try it Yourself!
|
101 |
-
|
102 |
"""
|
103 |
|
104 |
UPLOADABLE_FILE_TYPES = [".pdf", ".txt", ".docx", ".doc"]
|
@@ -107,9 +106,6 @@ css = """
|
|
107 |
.example-button {
|
108 |
font-size: 1rem;
|
109 |
font-weight: 400 !important;
|
110 |
-
display: flex;
|
111 |
-
gap: 1rem;
|
112 |
-
padding: 1rem;
|
113 |
}
|
114 |
"""
|
115 |
|
@@ -233,13 +229,14 @@ with gr.Blocks(css=css, theme=gr.themes.Default(spacing_size="sm", font=[gr.them
|
|
233 |
score = gr.Textbox(label="Score (FAIL if Hallucinated, PASS if not)")
|
234 |
gr.Markdown(EXAMPLES_HEADER)
|
235 |
with gr.Row():
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
|
|
243 |
|
244 |
model_dropdown.change(fn=update_client_base_url, inputs=[model_dropdown], outputs=[base_url_state])
|
245 |
u.upload(upload_file, u, [u, file_group, file_name, document])
|
|
|
96 |
"""
|
97 |
|
98 |
EXAMPLES_HEADER = """
|
99 |
+
<br />
|
100 |
# Try it Yourself!
|
|
|
101 |
"""
|
102 |
|
103 |
UPLOADABLE_FILE_TYPES = [".pdf", ".txt", ".docx", ".doc"]
|
|
|
106 |
.example-button {
|
107 |
font-size: 1rem;
|
108 |
font-weight: 400 !important;
|
|
|
|
|
|
|
109 |
}
|
110 |
"""
|
111 |
|
|
|
229 |
score = gr.Textbox(label="Score (FAIL if Hallucinated, PASS if not)")
|
230 |
gr.Markdown(EXAMPLES_HEADER)
|
231 |
with gr.Row():
|
232 |
+
with gr.Column():
|
233 |
+
for _, example in enumerate(EXAMPLES):
|
234 |
+
template_btn = gr.Button(f"{example['emoji']} {example['question']}", elem_classes="example-button")
|
235 |
+
template_btn.click(
|
236 |
+
fn=select_template,
|
237 |
+
inputs=[gr.State(example)],
|
238 |
+
outputs=[question, document, answer]
|
239 |
+
)
|
240 |
|
241 |
model_dropdown.change(fn=update_client_base_url, inputs=[model_dropdown], outputs=[base_url_state])
|
242 |
u.upload(upload_file, u, [u, file_group, file_name, document])
|