Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -229,15 +229,39 @@ div[class*="gradio-container"] .prose td:first-child {
|
|
| 229 |
}
|
| 230 |
div[class*="gradio-container"] .prose th:not(:first-child),
|
| 231 |
div[class*="gradio-container"] .prose td:not(:first-child) {
|
| 232 |
-
min-width: 90px;
|
| 233 |
-
|
| 234 |
-
width:auto !important;
|
| 235 |
text-align: center;
|
| 236 |
}
|
| 237 |
/* --- CUSTOM RULE FOR THE SECOND CHILD --- */
|
| 238 |
#model_specific_table .prose td:nth-child(2) {
|
| 239 |
text-align: left; /* Example: A custom alignment */
|
| 240 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 241 |
"""
|
| 242 |
|
| 243 |
introduction_text = """
|
|
@@ -408,6 +432,29 @@ with gr.Blocks(title="Sahara Benchmark Leaderboards", css=google_style_css) as d
|
|
| 408 |
inputs=model_dropdown,
|
| 409 |
outputs=[model_title_component, model_table_component]
|
| 410 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 411 |
with gr.Group(elem_classes="content-card"):
|
| 412 |
gr.Markdown("<br>")
|
| 413 |
gr.HTML("<h2>Citation</h2>If you use the Sahara benchmark for your scientific publication, or if you find the resources in this website useful, please cite our <a href='https://africa.dlnlp.ai/sahara/'>ACL2025 paper </a>as well as the papers of the <a href='https://africa.dlnlp.ai/sahara/tasks'>original authors</a>.")
|
|
|
|
| 229 |
}
|
| 230 |
div[class*="gradio-container"] .prose th:not(:first-child),
|
| 231 |
div[class*="gradio-container"] .prose td:not(:first-child) {
|
| 232 |
+
/* min-width: 90px;
|
| 233 |
+
max-width: 140px;
|
| 234 |
+
width:auto !important; */
|
| 235 |
text-align: center;
|
| 236 |
}
|
| 237 |
/* --- CUSTOM RULE FOR THE SECOND CHILD --- */
|
| 238 |
#model_specific_table .prose td:nth-child(2) {
|
| 239 |
text-align: left; /* Example: A custom alignment */
|
| 240 |
}
|
| 241 |
+
/* --- Styles for the Model Comparison Table --- */
|
| 242 |
+
|
| 243 |
+
/* Rule for the Second Column (Task Name) */
|
| 244 |
+
#models_comparasion_table .prose th:nth-child(2),
|
| 245 |
+
#models_comparasion_table .prose td:nth-child(2) {
|
| 246 |
+
width: 200px !important; /* Give it enough width */
|
| 247 |
+
text-align: left !important;
|
| 248 |
+
white-space: nowrap; /* Prevent text from wrapping */
|
| 249 |
+
}
|
| 250 |
+
|
| 251 |
+
/* Rule for the First Column (Cluster) */
|
| 252 |
+
#models_comparasion_table .prose th:first-child,
|
| 253 |
+
#models_comparasion_table .prose td:first-child {
|
| 254 |
+
width: 130px !important;
|
| 255 |
+
text-align: left !important;
|
| 256 |
+
}
|
| 257 |
+
|
| 258 |
+
/* Rule for other columns (Task ID, Metric, Scores, etc.) */
|
| 259 |
+
#models_comparasion_table .prose th:not(:nth-child(1)):not(:nth-child(2)),
|
| 260 |
+
#models_comparasion_table .prose td:not(:nth-child(1)):not(:nth-child(2)) {
|
| 261 |
+
width: 95px !important; /* Set a consistent width for other columns */
|
| 262 |
+
text-align: center;
|
| 263 |
+
}
|
| 264 |
+
|
| 265 |
"""
|
| 266 |
|
| 267 |
introduction_text = """
|
|
|
|
| 432 |
inputs=model_dropdown,
|
| 433 |
outputs=[model_title_component, model_table_component]
|
| 434 |
)
|
| 435 |
+
# --- NEW TAB TO COMPARE MODELS ---
|
| 436 |
+
with gr.Tab("Compare Models", id="compare", elem_id="models_comparasion_table"):
|
| 437 |
+
gr.HTML("<br><br><center><h2>Compare Two Models</h2></center><br>")
|
| 438 |
+
with gr.Row():
|
| 439 |
+
model_1_dd = gr.Dropdown(MODEL_NAME_LIST, label="Select Model 1", interactive=True)
|
| 440 |
+
model_2_dd = gr.Dropdown(MODEL_NAME_LIST, label="Select Model 2", interactive=True)
|
| 441 |
+
compare_btn = gr.Button("Compare")
|
| 442 |
+
comparison_output = gr.HTML("<p style='text-align:center;'>Select two models and click Compare to see the results.</p>")
|
| 443 |
+
|
| 444 |
+
def update_comparison_table(m1, m2):
|
| 445 |
+
if not m1 or not m2:
|
| 446 |
+
# Use gr.Info for a non-blocking alert
|
| 447 |
+
gr.Info("Please select both models before clicking Compare.")
|
| 448 |
+
return "<p style='text-align:center;'>Please select two models to compare.</p>"
|
| 449 |
+
# Call the new comparison function
|
| 450 |
+
df = compare_models(m1, m2)
|
| 451 |
+
return df_to_html(df)
|
| 452 |
+
|
| 453 |
+
compare_btn.click(
|
| 454 |
+
fn=update_comparison_table,
|
| 455 |
+
inputs=[model_1_dd, model_2_dd],
|
| 456 |
+
outputs=[comparison_output]
|
| 457 |
+
)
|
| 458 |
with gr.Group(elem_classes="content-card"):
|
| 459 |
gr.Markdown("<br>")
|
| 460 |
gr.HTML("<h2>Citation</h2>If you use the Sahara benchmark for your scientific publication, or if you find the resources in this website useful, please cite our <a href='https://africa.dlnlp.ai/sahara/'>ACL2025 paper </a>as well as the papers of the <a href='https://africa.dlnlp.ai/sahara/tasks'>original authors</a>.")
|