Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -79,14 +79,10 @@ 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
|
83 |
-
|
84 |
-
# Dynamically create one gr.JSON component for each model
|
85 |
-
output_comparisons = {}
|
86 |
-
for model in MODEL_OPTIONS:
|
87 |
-
output_comparisons[model] = gr.JSON(label=model)
|
88 |
-
|
89 |
output_history = gr.JSON(label="History", elem_id="output-history")
|
|
|
90 |
clear_history_button = gr.Button("Clear History")
|
91 |
|
92 |
# Add a button to clear the history
|
@@ -94,9 +90,7 @@ with gr.Blocks() as demo:
|
|
94 |
|
95 |
# Define the button to trigger generating comparisons
|
96 |
generate_button = gr.Button("Generate Comparisons")
|
97 |
-
|
98 |
-
# Ensure output_comparisons is defined before use
|
99 |
-
generate_button.click(generate_comparisons_with_history, inputs=[input_text, selected_models, gr.State()], outputs=[*output_comparisons.values(), output_history])
|
100 |
|
101 |
# Insert custom CSS using gr.HTML()
|
102 |
gr.HTML("""
|
|
|
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
|
|
|
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("""
|