Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -118,7 +118,7 @@ def generate_callout(ratio, scope_text):
|
|
118 |
f'<div style="text-align: right;">'
|
119 |
f' <div style="display: inline-block; background-color: #f2f2f2; padding: 10px; '
|
120 |
f' border-radius: 5px; margin-bottom:10px;">'
|
121 |
-
f' Energy difference of <strong>{ratio:,.1f}x</strong> for {scope_text}.'
|
122 |
f' </div>'
|
123 |
f'</div>'
|
124 |
)
|
@@ -303,32 +303,36 @@ with demo:
|
|
303 |
</div>
|
304 |
''')
|
305 |
|
306 |
-
# --- Global Callout ---
|
307 |
-
|
308 |
-
|
309 |
-
|
|
|
|
|
310 |
|
311 |
# --- Tabs for the different tasks ---
|
312 |
with gr.Tabs():
|
313 |
# --- Text Generation Tab ---
|
314 |
with gr.TabItem("Text Generation π¬"):
|
315 |
with gr.Row():
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
|
|
|
|
332 |
tg_table = gr.HTML()
|
333 |
init_callout, init_table = update_text_generation(model_class_options[0], "Low to High")
|
334 |
tg_callout.value = init_callout
|
@@ -338,12 +342,15 @@ with demo:
|
|
338 |
|
339 |
# --- Image Generation Tab ---
|
340 |
with gr.TabItem("Image Generation π·"):
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
|
|
|
|
|
|
347 |
img_table = gr.HTML()
|
348 |
init_callout, init_table = update_image_generation("Low to High")
|
349 |
img_callout.value = init_callout
|
@@ -352,12 +359,15 @@ with demo:
|
|
352 |
|
353 |
# --- Text Classification Tab ---
|
354 |
with gr.TabItem("Text Classification π"):
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
|
|
|
|
|
|
361 |
tc_table = gr.HTML()
|
362 |
init_callout, init_table = update_text_classification("Low to High")
|
363 |
tc_callout.value = init_callout
|
@@ -366,12 +376,15 @@ with demo:
|
|
366 |
|
367 |
# --- Image Classification Tab ---
|
368 |
with gr.TabItem("Image Classification πΌοΈ"):
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
|
|
|
|
|
|
375 |
ic_table = gr.HTML()
|
376 |
init_callout, init_table = update_image_classification("Low to High")
|
377 |
ic_callout.value = init_callout
|
@@ -380,12 +393,15 @@ with demo:
|
|
380 |
|
381 |
# --- Image Captioning Tab ---
|
382 |
with gr.TabItem("Image Captioning π"):
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
|
|
|
|
|
|
389 |
icap_table = gr.HTML()
|
390 |
init_callout, init_table = update_image_captioning("Low to High")
|
391 |
icap_callout.value = init_callout
|
@@ -394,12 +410,15 @@ with demo:
|
|
394 |
|
395 |
# --- Summarization Tab ---
|
396 |
with gr.TabItem("Summarization π"):
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
|
|
|
|
|
|
403 |
sum_table = gr.HTML()
|
404 |
init_callout, init_table = update_summarization("Low to High")
|
405 |
sum_callout.value = init_callout
|
@@ -408,12 +427,15 @@ with demo:
|
|
408 |
|
409 |
# --- Automatic Speech Recognition Tab ---
|
410 |
with gr.TabItem("Automatic Speech Recognition π¬"):
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
|
|
|
|
|
|
417 |
asr_table = gr.HTML()
|
418 |
init_callout, init_table = update_asr("Low to High")
|
419 |
asr_callout.value = init_callout
|
@@ -422,12 +444,15 @@ with demo:
|
|
422 |
|
423 |
# --- Object Detection Tab ---
|
424 |
with gr.TabItem("Object Detection π"):
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
|
|
|
|
|
|
431 |
od_table = gr.HTML()
|
432 |
init_callout, init_table = update_object_detection("Low to High")
|
433 |
od_callout.value = init_callout
|
@@ -436,12 +461,15 @@ with demo:
|
|
436 |
|
437 |
# --- Sentence Similarity Tab ---
|
438 |
with gr.TabItem("Sentence Similarity π"):
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
|
|
|
|
|
|
445 |
ss_table = gr.HTML()
|
446 |
init_callout, init_table = update_sentence_similarity("Low to High")
|
447 |
ss_callout.value = init_callout
|
@@ -450,12 +478,15 @@ with demo:
|
|
450 |
|
451 |
# --- Extractive QA Tab ---
|
452 |
with gr.TabItem("Extractive QA β"):
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
|
|
|
|
|
|
459 |
qa_table = gr.HTML()
|
460 |
init_callout, init_table = update_extractive_qa("Low to High")
|
461 |
qa_callout.value = init_callout
|
@@ -464,12 +495,15 @@ with demo:
|
|
464 |
|
465 |
# --- All Tasks Tab ---
|
466 |
with gr.TabItem("All Tasks π‘"):
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
|
|
|
|
|
|
473 |
all_table = gr.HTML()
|
474 |
init_callout, init_table = update_all_tasks("Low to High")
|
475 |
all_callout.value = init_callout
|
|
|
118 |
f'<div style="text-align: right;">'
|
119 |
f' <div style="display: inline-block; background-color: #f2f2f2; padding: 10px; '
|
120 |
f' border-radius: 5px; margin-bottom:10px;">'
|
121 |
+
f' Energy efficiency difference of <strong>{ratio:,.1f}x</strong> for {scope_text}.'
|
122 |
f' </div>'
|
123 |
f'</div>'
|
124 |
)
|
|
|
303 |
</div>
|
304 |
''')
|
305 |
|
306 |
+
# --- Global Welcome & Callout Row ---
|
307 |
+
with gr.Row():
|
308 |
+
with gr.Column(scale=8):
|
309 |
+
gr.Markdown("<div style='text-align: left; font-size: 1.2em; margin-top: 10px;'>Select different tasks to see scored models.</div>")
|
310 |
+
with gr.Column(scale=4):
|
311 |
+
global_callout = gr.HTML(get_global_callout())
|
312 |
|
313 |
# --- Tabs for the different tasks ---
|
314 |
with gr.Tabs():
|
315 |
# --- Text Generation Tab ---
|
316 |
with gr.TabItem("Text Generation π¬"):
|
317 |
with gr.Row():
|
318 |
+
with gr.Column(scale=8):
|
319 |
+
model_class_options = [
|
320 |
+
"A (Single Consumer GPU) <20B parameters",
|
321 |
+
"B (Single Cloud GPU) 20-66B parameters",
|
322 |
+
"C (Multiple Cloud GPUs) >66B parameters"
|
323 |
+
]
|
324 |
+
model_class_dropdown = gr.Dropdown(
|
325 |
+
choices=model_class_options,
|
326 |
+
label="Select Model Class",
|
327 |
+
value=model_class_options[0]
|
328 |
+
)
|
329 |
+
sort_dropdown_tg = gr.Dropdown(
|
330 |
+
choices=["Low to High", "High to Low"],
|
331 |
+
label="Sort",
|
332 |
+
value="Low to High"
|
333 |
+
)
|
334 |
+
with gr.Column(scale=4):
|
335 |
+
tg_callout = gr.HTML()
|
336 |
tg_table = gr.HTML()
|
337 |
init_callout, init_table = update_text_generation(model_class_options[0], "Low to High")
|
338 |
tg_callout.value = init_callout
|
|
|
342 |
|
343 |
# --- Image Generation Tab ---
|
344 |
with gr.TabItem("Image Generation π·"):
|
345 |
+
with gr.Row():
|
346 |
+
with gr.Column(scale=8):
|
347 |
+
sort_dropdown_img = gr.Dropdown(
|
348 |
+
choices=["Low to High", "High to Low"],
|
349 |
+
label="Sort",
|
350 |
+
value="Low to High"
|
351 |
+
)
|
352 |
+
with gr.Column(scale=4):
|
353 |
+
img_callout = gr.HTML()
|
354 |
img_table = gr.HTML()
|
355 |
init_callout, init_table = update_image_generation("Low to High")
|
356 |
img_callout.value = init_callout
|
|
|
359 |
|
360 |
# --- Text Classification Tab ---
|
361 |
with gr.TabItem("Text Classification π"):
|
362 |
+
with gr.Row():
|
363 |
+
with gr.Column(scale=8):
|
364 |
+
sort_dropdown_tc = gr.Dropdown(
|
365 |
+
choices=["Low to High", "High to Low"],
|
366 |
+
label="Sort",
|
367 |
+
value="Low to High"
|
368 |
+
)
|
369 |
+
with gr.Column(scale=4):
|
370 |
+
tc_callout = gr.HTML()
|
371 |
tc_table = gr.HTML()
|
372 |
init_callout, init_table = update_text_classification("Low to High")
|
373 |
tc_callout.value = init_callout
|
|
|
376 |
|
377 |
# --- Image Classification Tab ---
|
378 |
with gr.TabItem("Image Classification πΌοΈ"):
|
379 |
+
with gr.Row():
|
380 |
+
with gr.Column(scale=8):
|
381 |
+
sort_dropdown_ic = gr.Dropdown(
|
382 |
+
choices=["Low to High", "High to Low"],
|
383 |
+
label="Sort",
|
384 |
+
value="Low to High"
|
385 |
+
)
|
386 |
+
with gr.Column(scale=4):
|
387 |
+
ic_callout = gr.HTML()
|
388 |
ic_table = gr.HTML()
|
389 |
init_callout, init_table = update_image_classification("Low to High")
|
390 |
ic_callout.value = init_callout
|
|
|
393 |
|
394 |
# --- Image Captioning Tab ---
|
395 |
with gr.TabItem("Image Captioning π"):
|
396 |
+
with gr.Row():
|
397 |
+
with gr.Column(scale=8):
|
398 |
+
sort_dropdown_icap = gr.Dropdown(
|
399 |
+
choices=["Low to High", "High to Low"],
|
400 |
+
label="Sort",
|
401 |
+
value="Low to High"
|
402 |
+
)
|
403 |
+
with gr.Column(scale=4):
|
404 |
+
icap_callout = gr.HTML()
|
405 |
icap_table = gr.HTML()
|
406 |
init_callout, init_table = update_image_captioning("Low to High")
|
407 |
icap_callout.value = init_callout
|
|
|
410 |
|
411 |
# --- Summarization Tab ---
|
412 |
with gr.TabItem("Summarization π"):
|
413 |
+
with gr.Row():
|
414 |
+
with gr.Column(scale=8):
|
415 |
+
sort_dropdown_sum = gr.Dropdown(
|
416 |
+
choices=["Low to High", "High to Low"],
|
417 |
+
label="Sort",
|
418 |
+
value="Low to High"
|
419 |
+
)
|
420 |
+
with gr.Column(scale=4):
|
421 |
+
sum_callout = gr.HTML()
|
422 |
sum_table = gr.HTML()
|
423 |
init_callout, init_table = update_summarization("Low to High")
|
424 |
sum_callout.value = init_callout
|
|
|
427 |
|
428 |
# --- Automatic Speech Recognition Tab ---
|
429 |
with gr.TabItem("Automatic Speech Recognition π¬"):
|
430 |
+
with gr.Row():
|
431 |
+
with gr.Column(scale=8):
|
432 |
+
sort_dropdown_asr = gr.Dropdown(
|
433 |
+
choices=["Low to High", "High to Low"],
|
434 |
+
label="Sort",
|
435 |
+
value="Low to High"
|
436 |
+
)
|
437 |
+
with gr.Column(scale=4):
|
438 |
+
asr_callout = gr.HTML()
|
439 |
asr_table = gr.HTML()
|
440 |
init_callout, init_table = update_asr("Low to High")
|
441 |
asr_callout.value = init_callout
|
|
|
444 |
|
445 |
# --- Object Detection Tab ---
|
446 |
with gr.TabItem("Object Detection π"):
|
447 |
+
with gr.Row():
|
448 |
+
with gr.Column(scale=8):
|
449 |
+
sort_dropdown_od = gr.Dropdown(
|
450 |
+
choices=["Low to High", "High to Low"],
|
451 |
+
label="Sort",
|
452 |
+
value="Low to High"
|
453 |
+
)
|
454 |
+
with gr.Column(scale=4):
|
455 |
+
od_callout = gr.HTML()
|
456 |
od_table = gr.HTML()
|
457 |
init_callout, init_table = update_object_detection("Low to High")
|
458 |
od_callout.value = init_callout
|
|
|
461 |
|
462 |
# --- Sentence Similarity Tab ---
|
463 |
with gr.TabItem("Sentence Similarity π"):
|
464 |
+
with gr.Row():
|
465 |
+
with gr.Column(scale=8):
|
466 |
+
sort_dropdown_ss = gr.Dropdown(
|
467 |
+
choices=["Low to High", "High to Low"],
|
468 |
+
label="Sort",
|
469 |
+
value="Low to High"
|
470 |
+
)
|
471 |
+
with gr.Column(scale=4):
|
472 |
+
ss_callout = gr.HTML()
|
473 |
ss_table = gr.HTML()
|
474 |
init_callout, init_table = update_sentence_similarity("Low to High")
|
475 |
ss_callout.value = init_callout
|
|
|
478 |
|
479 |
# --- Extractive QA Tab ---
|
480 |
with gr.TabItem("Extractive QA β"):
|
481 |
+
with gr.Row():
|
482 |
+
with gr.Column(scale=8):
|
483 |
+
sort_dropdown_qa = gr.Dropdown(
|
484 |
+
choices=["Low to High", "High to Low"],
|
485 |
+
label="Sort",
|
486 |
+
value="Low to High"
|
487 |
+
)
|
488 |
+
with gr.Column(scale=4):
|
489 |
+
qa_callout = gr.HTML()
|
490 |
qa_table = gr.HTML()
|
491 |
init_callout, init_table = update_extractive_qa("Low to High")
|
492 |
qa_callout.value = init_callout
|
|
|
495 |
|
496 |
# --- All Tasks Tab ---
|
497 |
with gr.TabItem("All Tasks π‘"):
|
498 |
+
with gr.Row():
|
499 |
+
with gr.Column(scale=8):
|
500 |
+
sort_dropdown_all = gr.Dropdown(
|
501 |
+
choices=["Low to High", "High to Low"],
|
502 |
+
label="Sort",
|
503 |
+
value="Low to High"
|
504 |
+
)
|
505 |
+
with gr.Column(scale=4):
|
506 |
+
all_callout = gr.HTML()
|
507 |
all_table = gr.HTML()
|
508 |
init_callout, init_table = update_all_tasks("Low to High")
|
509 |
all_callout.value = init_callout
|