Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -77,17 +77,15 @@ def generate_html_table_from_df(df):
|
|
| 77 |
html += '<tr>'
|
| 78 |
html += f'<td style="padding: 8px; width: {static_width}px;">{row["Model"]}</td>'
|
| 79 |
html += f'<td style="padding: 8px;">{row["Provider"]}</td>'
|
| 80 |
-
html += (
|
| 81 |
-
|
| 82 |
-
f'<div style="background-color: {bar_color}; width: {bar_width:.1f}%; height: 10px;"></div></td>'
|
| 83 |
-
)
|
| 84 |
html += f'<td style="padding: 8px;">{row["Score"]}</td>'
|
| 85 |
html += '</tr>'
|
| 86 |
html += '</tbody></table>'
|
| 87 |
return f'<div class="table-container">{html}</div>'
|
| 88 |
|
| 89 |
def process_df(task, sort_order="Low to High", filter_fn=None):
|
| 90 |
-
df = pd.read_csv(
|
| 91 |
if df.columns[0].startswith("Unnamed:"):
|
| 92 |
df = df.iloc[:, 1:]
|
| 93 |
df['energy_score'] = df['energy_score'].astype(int)
|
|
@@ -123,7 +121,7 @@ def generate_info_callout(ratio, scope_text):
|
|
| 123 |
def get_global_callout():
|
| 124 |
all_df = pd.DataFrame()
|
| 125 |
for task in tasks:
|
| 126 |
-
df = pd.read_csv(
|
| 127 |
if df.columns[0].startswith("Unnamed:"):
|
| 128 |
df = df.iloc[:, 1:]
|
| 129 |
df['gpu_energy_numeric'] = pd.to_numeric(df['total_gpu_energy'], errors='raise') * 1000
|
|
@@ -134,7 +132,7 @@ def get_global_callout():
|
|
| 134 |
### ZIP DOWNLOAD FUNCTIONS ###
|
| 135 |
|
| 136 |
def zip_csv_files():
|
| 137 |
-
data_dir = "data
|
| 138 |
zip_filename = "data.zip"
|
| 139 |
with zipfile.ZipFile(zip_filename, "w", zipfile.ZIP_DEFLATED) as zipf:
|
| 140 |
for filename in os.listdir(data_dir):
|
|
@@ -241,7 +239,7 @@ def update_extractive_qa(sort_order):
|
|
| 241 |
def update_all_tasks(sort_order):
|
| 242 |
all_df = pd.DataFrame()
|
| 243 |
for task in tasks:
|
| 244 |
-
df = pd.read_csv(
|
| 245 |
if df.columns[0].startswith("Unnamed:"):
|
| 246 |
df = df.iloc[:, 1:]
|
| 247 |
df['energy_score'] = df['energy_score'].astype(int)
|
|
@@ -260,6 +258,18 @@ def update_all_tasks(sort_order):
|
|
| 260 |
|
| 261 |
### BUILD THE GRADIO INTERFACE ###
|
| 262 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 263 |
demo = gr.Blocks(css="""
|
| 264 |
.gr-dataframe table {
|
| 265 |
table-layout: fixed;
|
|
@@ -279,8 +289,8 @@ demo = gr.Blocks(css="""
|
|
| 279 |
""")
|
| 280 |
|
| 281 |
with demo:
|
| 282 |
-
#
|
| 283 |
-
gr.HTML(f
|
| 284 |
<div style="display: flex; justify-content: space-evenly; align-items: center; margin-bottom: 20px;">
|
| 285 |
<a href="https://huggingface.co/spaces/AIEnergyScore/submission_portal" style="text-decoration: none; font-weight: bold; font-size: 1.1em; color: black; font-family: 'Inter', sans-serif;">Submission Portal</a>
|
| 286 |
<a href="https://huggingface.co/spaces/AIEnergyScore/Label" style="text-decoration: none; font-weight: bold; font-size: 1.1em; color: black; font-family: 'Inter', sans-serif;">Label Generator</a>
|
|
@@ -289,51 +299,14 @@ with demo:
|
|
| 289 |
{get_zip_data_link()}
|
| 290 |
<a href="https://huggingface.co/spaces/AIEnergyScore/README/discussions" style="text-decoration: none; font-weight: bold; font-size: 1.1em; color: black; font-family: 'Inter', sans-serif;">Community</a>
|
| 291 |
</div>
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
#
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
alt="Logo"
|
| 299 |
-
style="width:300px; max-width:300px; height:auto; display: inline-block;">
|
| 300 |
-
<div style="position: absolute; top: 50%; left: calc(50% + 160px); transform: translateY(-50%);">
|
| 301 |
-
<!-- Insert the global callout HTML here -->
|
| 302 |
-
{global_callout_html}
|
| 303 |
-
</div>
|
| 304 |
-
</div>
|
| 305 |
-
{% endraw %}
|
| 306 |
-
{% raw %}
|
| 307 |
-
<script>
|
| 308 |
-
// The following script block is just a placeholder. In Gradio we will generate the full HTML in Python.
|
| 309 |
-
</script>
|
| 310 |
-
{% endraw %}
|
| 311 |
-
|
| 312 |
-
{% endraw %}
|
| 313 |
-
{% raw %}
|
| 314 |
-
<script>
|
| 315 |
-
</script>
|
| 316 |
-
{% endraw %}
|
| 317 |
-
{% raw %}
|
| 318 |
-
{% endraw %}
|
| 319 |
-
{# Compute the global callout HTML in Python #}
|
| 320 |
-
{% python %}
|
| 321 |
-
global_callout_html = get_global_callout()
|
| 322 |
-
{% endpython %}
|
| 323 |
-
{% raw %}
|
| 324 |
-
<div style="position: relative; width: 100%; text-align: center; margin-bottom: 20px;">
|
| 325 |
-
<img src="https://huggingface.co/spaces/AIEnergyScore/Leaderboard/resolve/main/logo.png"
|
| 326 |
-
alt="Logo"
|
| 327 |
-
style="width:300px; max-width:300px; height:auto; display: inline-block;">
|
| 328 |
-
<div style="position: absolute; top: 50%; left: calc(50% + 160px); transform: translateY(-50%);">
|
| 329 |
-
{global_callout_html}
|
| 330 |
-
</div>
|
| 331 |
-
</div>
|
| 332 |
-
{% endraw %}
|
| 333 |
-
|
| 334 |
-
<!-- --- Tabs for the different tasks --- -->
|
| 335 |
with gr.Tabs():
|
| 336 |
-
#
|
| 337 |
with gr.TabItem("Text Generation π¬"):
|
| 338 |
with gr.Row():
|
| 339 |
with gr.Column(scale=4):
|
|
@@ -342,17 +315,9 @@ global_callout_html = get_global_callout()
|
|
| 342 |
"B (Single Cloud GPU) 20-66B parameters",
|
| 343 |
"C (Multiple Cloud GPUs) >66B parameters"
|
| 344 |
]
|
| 345 |
-
model_class_dropdown = gr.Dropdown(
|
| 346 |
-
choices=model_class_options,
|
| 347 |
-
label="Select Model Class",
|
| 348 |
-
value=model_class_options[0]
|
| 349 |
-
)
|
| 350 |
with gr.Column(scale=4):
|
| 351 |
-
sort_dropdown_tg = gr.Dropdown(
|
| 352 |
-
choices=["Low to High", "High to Low"],
|
| 353 |
-
label="Sort",
|
| 354 |
-
value="Low to High"
|
| 355 |
-
)
|
| 356 |
with gr.Column(scale=4):
|
| 357 |
tg_callout = gr.HTML()
|
| 358 |
tg_table = gr.HTML()
|
|
@@ -362,15 +327,11 @@ global_callout_html = get_global_callout()
|
|
| 362 |
model_class_dropdown.change(fn=update_text_generation, inputs=[model_class_dropdown, sort_dropdown_tg], outputs=[tg_callout, tg_table])
|
| 363 |
sort_dropdown_tg.change(fn=update_text_generation, inputs=[model_class_dropdown, sort_dropdown_tg], outputs=[tg_callout, tg_table])
|
| 364 |
|
| 365 |
-
#
|
| 366 |
with gr.TabItem("Image Generation π·"):
|
| 367 |
with gr.Row():
|
| 368 |
with gr.Column(scale=8):
|
| 369 |
-
sort_dropdown_img = gr.Dropdown(
|
| 370 |
-
choices=["Low to High", "High to Low"],
|
| 371 |
-
label="Sort",
|
| 372 |
-
value="Low to High"
|
| 373 |
-
)
|
| 374 |
with gr.Column(scale=4):
|
| 375 |
img_callout = gr.HTML()
|
| 376 |
img_table = gr.HTML()
|
|
@@ -379,15 +340,11 @@ global_callout_html = get_global_callout()
|
|
| 379 |
img_table.value = init_table
|
| 380 |
sort_dropdown_img.change(fn=update_image_generation, inputs=sort_dropdown_img, outputs=[img_callout, img_table])
|
| 381 |
|
| 382 |
-
#
|
| 383 |
with gr.TabItem("Text Classification π"):
|
| 384 |
with gr.Row():
|
| 385 |
with gr.Column(scale=8):
|
| 386 |
-
sort_dropdown_tc = gr.Dropdown(
|
| 387 |
-
choices=["Low to High", "High to Low"],
|
| 388 |
-
label="Sort",
|
| 389 |
-
value="Low to High"
|
| 390 |
-
)
|
| 391 |
with gr.Column(scale=4):
|
| 392 |
tc_callout = gr.HTML()
|
| 393 |
tc_table = gr.HTML()
|
|
@@ -396,15 +353,11 @@ global_callout_html = get_global_callout()
|
|
| 396 |
tc_table.value = init_table
|
| 397 |
sort_dropdown_tc.change(fn=update_text_classification, inputs=sort_dropdown_tc, outputs=[tc_callout, tc_table])
|
| 398 |
|
| 399 |
-
#
|
| 400 |
with gr.TabItem("Image Classification πΌοΈ"):
|
| 401 |
with gr.Row():
|
| 402 |
with gr.Column(scale=8):
|
| 403 |
-
sort_dropdown_ic = gr.Dropdown(
|
| 404 |
-
choices=["Low to High", "High to Low"],
|
| 405 |
-
label="Sort",
|
| 406 |
-
value="Low to High"
|
| 407 |
-
)
|
| 408 |
with gr.Column(scale=4):
|
| 409 |
ic_callout = gr.HTML()
|
| 410 |
ic_table = gr.HTML()
|
|
@@ -413,15 +366,11 @@ global_callout_html = get_global_callout()
|
|
| 413 |
ic_table.value = init_table
|
| 414 |
sort_dropdown_ic.change(fn=update_image_classification, inputs=sort_dropdown_ic, outputs=[ic_callout, ic_table])
|
| 415 |
|
| 416 |
-
#
|
| 417 |
with gr.TabItem("Image Captioning π"):
|
| 418 |
with gr.Row():
|
| 419 |
with gr.Column(scale=8):
|
| 420 |
-
sort_dropdown_icap = gr.Dropdown(
|
| 421 |
-
choices=["Low to High", "High to Low"],
|
| 422 |
-
label="Sort",
|
| 423 |
-
value="Low to High"
|
| 424 |
-
)
|
| 425 |
with gr.Column(scale=4):
|
| 426 |
icap_callout = gr.HTML()
|
| 427 |
icap_table = gr.HTML()
|
|
@@ -430,15 +379,11 @@ global_callout_html = get_global_callout()
|
|
| 430 |
icap_table.value = init_table
|
| 431 |
sort_dropdown_icap.change(fn=update_image_captioning, inputs=sort_dropdown_icap, outputs=[icap_callout, icap_table])
|
| 432 |
|
| 433 |
-
#
|
| 434 |
with gr.TabItem("Summarization π"):
|
| 435 |
with gr.Row():
|
| 436 |
with gr.Column(scale=8):
|
| 437 |
-
sort_dropdown_sum = gr.Dropdown(
|
| 438 |
-
choices=["Low to High", "High to Low"],
|
| 439 |
-
label="Sort",
|
| 440 |
-
value="Low to High"
|
| 441 |
-
)
|
| 442 |
with gr.Column(scale=4):
|
| 443 |
sum_callout = gr.HTML()
|
| 444 |
sum_table = gr.HTML()
|
|
@@ -447,15 +392,11 @@ global_callout_html = get_global_callout()
|
|
| 447 |
sum_table.value = init_table
|
| 448 |
sort_dropdown_sum.change(fn=update_summarization, inputs=sort_dropdown_sum, outputs=[sum_callout, sum_table])
|
| 449 |
|
| 450 |
-
#
|
| 451 |
with gr.TabItem("Automatic Speech Recognition π¬"):
|
| 452 |
with gr.Row():
|
| 453 |
with gr.Column(scale=8):
|
| 454 |
-
sort_dropdown_asr = gr.Dropdown(
|
| 455 |
-
choices=["Low to High", "High to Low"],
|
| 456 |
-
label="Sort",
|
| 457 |
-
value="Low to High"
|
| 458 |
-
)
|
| 459 |
with gr.Column(scale=4):
|
| 460 |
asr_callout = gr.HTML()
|
| 461 |
asr_table = gr.HTML()
|
|
@@ -464,15 +405,11 @@ global_callout_html = get_global_callout()
|
|
| 464 |
asr_table.value = init_table
|
| 465 |
sort_dropdown_asr.change(fn=update_asr, inputs=sort_dropdown_asr, outputs=[asr_callout, asr_table])
|
| 466 |
|
| 467 |
-
#
|
| 468 |
with gr.TabItem("Object Detection π"):
|
| 469 |
with gr.Row():
|
| 470 |
with gr.Column(scale=8):
|
| 471 |
-
sort_dropdown_od = gr.Dropdown(
|
| 472 |
-
choices=["Low to High", "High to Low"],
|
| 473 |
-
label="Sort",
|
| 474 |
-
value="Low to High"
|
| 475 |
-
)
|
| 476 |
with gr.Column(scale=4):
|
| 477 |
od_callout = gr.HTML()
|
| 478 |
od_table = gr.HTML()
|
|
@@ -481,15 +418,11 @@ global_callout_html = get_global_callout()
|
|
| 481 |
od_table.value = init_table
|
| 482 |
sort_dropdown_od.change(fn=update_object_detection, inputs=sort_dropdown_od, outputs=[od_callout, od_table])
|
| 483 |
|
| 484 |
-
#
|
| 485 |
with gr.TabItem("Sentence Similarity π"):
|
| 486 |
with gr.Row():
|
| 487 |
with gr.Column(scale=8):
|
| 488 |
-
sort_dropdown_ss = gr.Dropdown(
|
| 489 |
-
choices=["Low to High", "High to Low"],
|
| 490 |
-
label="Sort",
|
| 491 |
-
value="Low to High"
|
| 492 |
-
)
|
| 493 |
with gr.Column(scale=4):
|
| 494 |
ss_callout = gr.HTML()
|
| 495 |
ss_table = gr.HTML()
|
|
@@ -498,15 +431,11 @@ global_callout_html = get_global_callout()
|
|
| 498 |
ss_table.value = init_table
|
| 499 |
sort_dropdown_ss.change(fn=update_sentence_similarity, inputs=sort_dropdown_ss, outputs=[ss_callout, ss_table])
|
| 500 |
|
| 501 |
-
#
|
| 502 |
with gr.TabItem("Extractive QA β"):
|
| 503 |
with gr.Row():
|
| 504 |
with gr.Column(scale=8):
|
| 505 |
-
sort_dropdown_qa = gr.Dropdown(
|
| 506 |
-
choices=["Low to High", "High to Low"],
|
| 507 |
-
label="Sort",
|
| 508 |
-
value="Low to High"
|
| 509 |
-
)
|
| 510 |
with gr.Column(scale=4):
|
| 511 |
qa_callout = gr.HTML()
|
| 512 |
qa_table = gr.HTML()
|
|
@@ -515,15 +444,11 @@ global_callout_html = get_global_callout()
|
|
| 515 |
qa_table.value = init_table
|
| 516 |
sort_dropdown_qa.change(fn=update_extractive_qa, inputs=sort_dropdown_qa, outputs=[qa_callout, qa_table])
|
| 517 |
|
| 518 |
-
#
|
| 519 |
with gr.TabItem("All Tasks π‘"):
|
| 520 |
with gr.Row():
|
| 521 |
with gr.Column(scale=8):
|
| 522 |
-
sort_dropdown_all = gr.Dropdown(
|
| 523 |
-
choices=["Low to High", "High to Low"],
|
| 524 |
-
label="Sort",
|
| 525 |
-
value="Low to High"
|
| 526 |
-
)
|
| 527 |
with gr.Column(scale=4):
|
| 528 |
all_callout = gr.HTML()
|
| 529 |
all_table = gr.HTML()
|
|
@@ -542,4 +467,4 @@ global_callout_html = get_global_callout()
|
|
| 542 |
)
|
| 543 |
gr.Markdown("Last updated: February 2025")
|
| 544 |
|
| 545 |
-
demo.launch()
|
|
|
|
| 77 |
html += '<tr>'
|
| 78 |
html += f'<td style="padding: 8px; width: {static_width}px;">{row["Model"]}</td>'
|
| 79 |
html += f'<td style="padding: 8px;">{row["Provider"]}</td>'
|
| 80 |
+
html += (f'<td style="padding: 8px;">{energy_str}<br>'
|
| 81 |
+
f'<div style="background-color: {bar_color}; width: {bar_width:.1f}%; height: 10px;"></div></td>')
|
|
|
|
|
|
|
| 82 |
html += f'<td style="padding: 8px;">{row["Score"]}</td>'
|
| 83 |
html += '</tr>'
|
| 84 |
html += '</tbody></table>'
|
| 85 |
return f'<div class="table-container">{html}</div>'
|
| 86 |
|
| 87 |
def process_df(task, sort_order="Low to High", filter_fn=None):
|
| 88 |
+
df = pd.read_csv(os.path.join("data", "energy", task))
|
| 89 |
if df.columns[0].startswith("Unnamed:"):
|
| 90 |
df = df.iloc[:, 1:]
|
| 91 |
df['energy_score'] = df['energy_score'].astype(int)
|
|
|
|
| 121 |
def get_global_callout():
|
| 122 |
all_df = pd.DataFrame()
|
| 123 |
for task in tasks:
|
| 124 |
+
df = pd.read_csv(os.path.join("data", "energy", task))
|
| 125 |
if df.columns[0].startswith("Unnamed:"):
|
| 126 |
df = df.iloc[:, 1:]
|
| 127 |
df['gpu_energy_numeric'] = pd.to_numeric(df['total_gpu_energy'], errors='raise') * 1000
|
|
|
|
| 132 |
### ZIP DOWNLOAD FUNCTIONS ###
|
| 133 |
|
| 134 |
def zip_csv_files():
|
| 135 |
+
data_dir = os.path.join("data", "energy")
|
| 136 |
zip_filename = "data.zip"
|
| 137 |
with zipfile.ZipFile(zip_filename, "w", zipfile.ZIP_DEFLATED) as zipf:
|
| 138 |
for filename in os.listdir(data_dir):
|
|
|
|
| 239 |
def update_all_tasks(sort_order):
|
| 240 |
all_df = pd.DataFrame()
|
| 241 |
for task in tasks:
|
| 242 |
+
df = pd.read_csv(os.path.join("data", "energy", task))
|
| 243 |
if df.columns[0].startswith("Unnamed:"):
|
| 244 |
df = df.iloc[:, 1:]
|
| 245 |
df['energy_score'] = df['energy_score'].astype(int)
|
|
|
|
| 258 |
|
| 259 |
### BUILD THE GRADIO INTERFACE ###
|
| 260 |
|
| 261 |
+
# Compute the global header HTML using the global callout.
|
| 262 |
+
global_header_html = f"""
|
| 263 |
+
<div style="position: relative; width: 100%; text-align: center; margin-bottom: 20px;">
|
| 264 |
+
<img src="https://huggingface.co/spaces/AIEnergyScore/Leaderboard/resolve/main/logo.png"
|
| 265 |
+
alt="Logo"
|
| 266 |
+
style="width:300px; max-width:300px; height:auto; display: inline-block;">
|
| 267 |
+
<div style="position: absolute; top: 50%; left: calc(50% + 160px); transform: translateY(-50%);">
|
| 268 |
+
{get_global_callout()}
|
| 269 |
+
</div>
|
| 270 |
+
</div>
|
| 271 |
+
"""
|
| 272 |
+
|
| 273 |
demo = gr.Blocks(css="""
|
| 274 |
.gr-dataframe table {
|
| 275 |
table-layout: fixed;
|
|
|
|
| 289 |
""")
|
| 290 |
|
| 291 |
with demo:
|
| 292 |
+
# Header Links
|
| 293 |
+
gr.HTML(f"""
|
| 294 |
<div style="display: flex; justify-content: space-evenly; align-items: center; margin-bottom: 20px;">
|
| 295 |
<a href="https://huggingface.co/spaces/AIEnergyScore/submission_portal" style="text-decoration: none; font-weight: bold; font-size: 1.1em; color: black; font-family: 'Inter', sans-serif;">Submission Portal</a>
|
| 296 |
<a href="https://huggingface.co/spaces/AIEnergyScore/Label" style="text-decoration: none; font-weight: bold; font-size: 1.1em; color: black; font-family: 'Inter', sans-serif;">Label Generator</a>
|
|
|
|
| 299 |
{get_zip_data_link()}
|
| 300 |
<a href="https://huggingface.co/spaces/AIEnergyScore/README/discussions" style="text-decoration: none; font-weight: bold; font-size: 1.1em; color: black; font-family: 'Inter', sans-serif;">Community</a>
|
| 301 |
</div>
|
| 302 |
+
""")
|
| 303 |
+
|
| 304 |
+
# Global Header: Centered Logo with Global Callout
|
| 305 |
+
gr.HTML(global_header_html)
|
| 306 |
+
|
| 307 |
+
# Tabs for different tasks
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 308 |
with gr.Tabs():
|
| 309 |
+
# Text Generation Tab
|
| 310 |
with gr.TabItem("Text Generation π¬"):
|
| 311 |
with gr.Row():
|
| 312 |
with gr.Column(scale=4):
|
|
|
|
| 315 |
"B (Single Cloud GPU) 20-66B parameters",
|
| 316 |
"C (Multiple Cloud GPUs) >66B parameters"
|
| 317 |
]
|
| 318 |
+
model_class_dropdown = gr.Dropdown(choices=model_class_options, label="Select Model Class", value=model_class_options[0])
|
|
|
|
|
|
|
|
|
|
|
|
|
| 319 |
with gr.Column(scale=4):
|
| 320 |
+
sort_dropdown_tg = gr.Dropdown(choices=["Low to High", "High to Low"], label="Sort", value="Low to High")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 321 |
with gr.Column(scale=4):
|
| 322 |
tg_callout = gr.HTML()
|
| 323 |
tg_table = gr.HTML()
|
|
|
|
| 327 |
model_class_dropdown.change(fn=update_text_generation, inputs=[model_class_dropdown, sort_dropdown_tg], outputs=[tg_callout, tg_table])
|
| 328 |
sort_dropdown_tg.change(fn=update_text_generation, inputs=[model_class_dropdown, sort_dropdown_tg], outputs=[tg_callout, tg_table])
|
| 329 |
|
| 330 |
+
# Image Generation Tab
|
| 331 |
with gr.TabItem("Image Generation π·"):
|
| 332 |
with gr.Row():
|
| 333 |
with gr.Column(scale=8):
|
| 334 |
+
sort_dropdown_img = gr.Dropdown(choices=["Low to High", "High to Low"], label="Sort", value="Low to High")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 335 |
with gr.Column(scale=4):
|
| 336 |
img_callout = gr.HTML()
|
| 337 |
img_table = gr.HTML()
|
|
|
|
| 340 |
img_table.value = init_table
|
| 341 |
sort_dropdown_img.change(fn=update_image_generation, inputs=sort_dropdown_img, outputs=[img_callout, img_table])
|
| 342 |
|
| 343 |
+
# Text Classification Tab
|
| 344 |
with gr.TabItem("Text Classification π"):
|
| 345 |
with gr.Row():
|
| 346 |
with gr.Column(scale=8):
|
| 347 |
+
sort_dropdown_tc = gr.Dropdown(choices=["Low to High", "High to Low"], label="Sort", value="Low to High")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 348 |
with gr.Column(scale=4):
|
| 349 |
tc_callout = gr.HTML()
|
| 350 |
tc_table = gr.HTML()
|
|
|
|
| 353 |
tc_table.value = init_table
|
| 354 |
sort_dropdown_tc.change(fn=update_text_classification, inputs=sort_dropdown_tc, outputs=[tc_callout, tc_table])
|
| 355 |
|
| 356 |
+
# Image Classification Tab
|
| 357 |
with gr.TabItem("Image Classification πΌοΈ"):
|
| 358 |
with gr.Row():
|
| 359 |
with gr.Column(scale=8):
|
| 360 |
+
sort_dropdown_ic = gr.Dropdown(choices=["Low to High", "High to Low"], label="Sort", value="Low to High")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 361 |
with gr.Column(scale=4):
|
| 362 |
ic_callout = gr.HTML()
|
| 363 |
ic_table = gr.HTML()
|
|
|
|
| 366 |
ic_table.value = init_table
|
| 367 |
sort_dropdown_ic.change(fn=update_image_classification, inputs=sort_dropdown_ic, outputs=[ic_callout, ic_table])
|
| 368 |
|
| 369 |
+
# Image Captioning Tab
|
| 370 |
with gr.TabItem("Image Captioning π"):
|
| 371 |
with gr.Row():
|
| 372 |
with gr.Column(scale=8):
|
| 373 |
+
sort_dropdown_icap = gr.Dropdown(choices=["Low to High", "High to Low"], label="Sort", value="Low to High")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 374 |
with gr.Column(scale=4):
|
| 375 |
icap_callout = gr.HTML()
|
| 376 |
icap_table = gr.HTML()
|
|
|
|
| 379 |
icap_table.value = init_table
|
| 380 |
sort_dropdown_icap.change(fn=update_image_captioning, inputs=sort_dropdown_icap, outputs=[icap_callout, icap_table])
|
| 381 |
|
| 382 |
+
# Summarization Tab
|
| 383 |
with gr.TabItem("Summarization π"):
|
| 384 |
with gr.Row():
|
| 385 |
with gr.Column(scale=8):
|
| 386 |
+
sort_dropdown_sum = gr.Dropdown(choices=["Low to High", "High to Low"], label="Sort", value="Low to High")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 387 |
with gr.Column(scale=4):
|
| 388 |
sum_callout = gr.HTML()
|
| 389 |
sum_table = gr.HTML()
|
|
|
|
| 392 |
sum_table.value = init_table
|
| 393 |
sort_dropdown_sum.change(fn=update_summarization, inputs=sort_dropdown_sum, outputs=[sum_callout, sum_table])
|
| 394 |
|
| 395 |
+
# Automatic Speech Recognition Tab
|
| 396 |
with gr.TabItem("Automatic Speech Recognition π¬"):
|
| 397 |
with gr.Row():
|
| 398 |
with gr.Column(scale=8):
|
| 399 |
+
sort_dropdown_asr = gr.Dropdown(choices=["Low to High", "High to Low"], label="Sort", value="Low to High")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 400 |
with gr.Column(scale=4):
|
| 401 |
asr_callout = gr.HTML()
|
| 402 |
asr_table = gr.HTML()
|
|
|
|
| 405 |
asr_table.value = init_table
|
| 406 |
sort_dropdown_asr.change(fn=update_asr, inputs=sort_dropdown_asr, outputs=[asr_callout, asr_table])
|
| 407 |
|
| 408 |
+
# Object Detection Tab
|
| 409 |
with gr.TabItem("Object Detection π"):
|
| 410 |
with gr.Row():
|
| 411 |
with gr.Column(scale=8):
|
| 412 |
+
sort_dropdown_od = gr.Dropdown(choices=["Low to High", "High to Low"], label="Sort", value="Low to High")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 413 |
with gr.Column(scale=4):
|
| 414 |
od_callout = gr.HTML()
|
| 415 |
od_table = gr.HTML()
|
|
|
|
| 418 |
od_table.value = init_table
|
| 419 |
sort_dropdown_od.change(fn=update_object_detection, inputs=sort_dropdown_od, outputs=[od_callout, od_table])
|
| 420 |
|
| 421 |
+
# Sentence Similarity Tab
|
| 422 |
with gr.TabItem("Sentence Similarity π"):
|
| 423 |
with gr.Row():
|
| 424 |
with gr.Column(scale=8):
|
| 425 |
+
sort_dropdown_ss = gr.Dropdown(choices=["Low to High", "High to Low"], label="Sort", value="Low to High")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 426 |
with gr.Column(scale=4):
|
| 427 |
ss_callout = gr.HTML()
|
| 428 |
ss_table = gr.HTML()
|
|
|
|
| 431 |
ss_table.value = init_table
|
| 432 |
sort_dropdown_ss.change(fn=update_sentence_similarity, inputs=sort_dropdown_ss, outputs=[ss_callout, ss_table])
|
| 433 |
|
| 434 |
+
# Extractive QA Tab
|
| 435 |
with gr.TabItem("Extractive QA β"):
|
| 436 |
with gr.Row():
|
| 437 |
with gr.Column(scale=8):
|
| 438 |
+
sort_dropdown_qa = gr.Dropdown(choices=["Low to High", "High to Low"], label="Sort", value="Low to High")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 439 |
with gr.Column(scale=4):
|
| 440 |
qa_callout = gr.HTML()
|
| 441 |
qa_table = gr.HTML()
|
|
|
|
| 444 |
qa_table.value = init_table
|
| 445 |
sort_dropdown_qa.change(fn=update_extractive_qa, inputs=sort_dropdown_qa, outputs=[qa_callout, qa_table])
|
| 446 |
|
| 447 |
+
# All Tasks Tab
|
| 448 |
with gr.TabItem("All Tasks π‘"):
|
| 449 |
with gr.Row():
|
| 450 |
with gr.Column(scale=8):
|
| 451 |
+
sort_dropdown_all = gr.Dropdown(choices=["Low to High", "High to Low"], label="Sort", value="Low to High")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 452 |
with gr.Column(scale=4):
|
| 453 |
all_callout = gr.HTML()
|
| 454 |
all_table = gr.HTML()
|
|
|
|
| 467 |
)
|
| 468 |
gr.Markdown("Last updated: February 2025")
|
| 469 |
|
| 470 |
+
demo.launch()
|