Update app.py
Browse files
app.py
CHANGED
|
@@ -78,20 +78,24 @@ def clear_history():
|
|
| 78 |
with gr.Blocks() as demo:
|
| 79 |
input_text = gr.Textbox(lines=2, label="Input Text", placeholder="Enter your query here")
|
| 80 |
selected_models = gr.CheckboxGroup(choices=MODEL_OPTIONS, label="Select Models", value=[MODEL_OPTIONS[0]])
|
| 81 |
-
|
| 82 |
-
# Define output components with scrollable containers
|
| 83 |
-
output_comparisons = gr.JSON(label="Model Comparisons", elem_id="output-comparisons")
|
| 84 |
-
output_history = gr.JSON(label="History", elem_id="output-history")
|
| 85 |
-
|
| 86 |
-
clear_history_button = gr.Button("Clear History")
|
| 87 |
|
| 88 |
-
# Add a button to clear the history
|
| 89 |
-
clear_history_button.click(clear_history, outputs=output_history)
|
| 90 |
-
|
| 91 |
# Define the button to trigger generating comparisons
|
| 92 |
generate_button = gr.Button("Generate Comparisons")
|
| 93 |
generate_button.click(generate_comparisons_with_history, inputs=[input_text, selected_models, gr.State()], outputs=[output_comparisons, output_history])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
|
|
|
|
|
|
|
|
|
|
| 95 |
# Insert custom CSS using gr.HTML()
|
| 96 |
gr.HTML("""
|
| 97 |
<style>
|
|
|
|
| 78 |
with gr.Blocks() as demo:
|
| 79 |
input_text = gr.Textbox(lines=2, label="Input Text", placeholder="Enter your query here")
|
| 80 |
selected_models = gr.CheckboxGroup(choices=MODEL_OPTIONS, label="Select Models", value=[MODEL_OPTIONS[0]])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
|
|
|
|
|
|
|
|
|
|
| 82 |
# Define the button to trigger generating comparisons
|
| 83 |
generate_button = gr.Button("Generate Comparisons")
|
| 84 |
generate_button.click(generate_comparisons_with_history, inputs=[input_text, selected_models, gr.State()], outputs=[output_comparisons, output_history])
|
| 85 |
+
|
| 86 |
+
# Define output components with tabs
|
| 87 |
+
with gr.Tabs() as tabs:
|
| 88 |
+
output_comparisons = []
|
| 89 |
+
for model in MODEL_OPTIONS:
|
| 90 |
+
with gr.Tab(model):
|
| 91 |
+
output_comparisons.append(gr.JSON(label=model, elem_id=f"output-{model}"))
|
| 92 |
+
|
| 93 |
+
output_history = gr.JSON(label="History", elem_id="output-history")
|
| 94 |
+
clear_history_button = gr.Button("Clear History")
|
| 95 |
|
| 96 |
+
# Add a button to clear the history
|
| 97 |
+
clear_history_button.click(clear_history, outputs=output_history)
|
| 98 |
+
|
| 99 |
# Insert custom CSS using gr.HTML()
|
| 100 |
gr.HTML("""
|
| 101 |
<style>
|