bgamazay commited on
Commit
d4f7fe0
Β·
verified Β·
1 Parent(s): bc9e568

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +115 -81
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
- global_callout = gr.HTML(get_global_callout())
308
-
309
- gr.Markdown('<div style="text-align: center; margin-top: 10px;">Select different tasks to see scored models.</div>')
 
 
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
- model_class_options = [
317
- "A (Single Consumer GPU) <20B parameters",
318
- "B (Single Cloud GPU) 20-66B parameters",
319
- "C (Multiple Cloud GPUs) >66B parameters"
320
- ]
321
- model_class_dropdown = gr.Dropdown(
322
- choices=model_class_options,
323
- label="Select Model Class",
324
- value=model_class_options[0]
325
- )
326
- sort_dropdown_tg = gr.Dropdown(
327
- choices=["Low to High", "High to Low"],
328
- label="Sort",
329
- value="Low to High"
330
- )
331
- tg_callout = gr.HTML()
 
 
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
- sort_dropdown_img = gr.Dropdown(
342
- choices=["Low to High", "High to Low"],
343
- label="Sort",
344
- value="Low to High"
345
- )
346
- img_callout = gr.HTML()
 
 
 
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
- sort_dropdown_tc = gr.Dropdown(
356
- choices=["Low to High", "High to Low"],
357
- label="Sort",
358
- value="Low to High"
359
- )
360
- tc_callout = gr.HTML()
 
 
 
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
- sort_dropdown_ic = gr.Dropdown(
370
- choices=["Low to High", "High to Low"],
371
- label="Sort",
372
- value="Low to High"
373
- )
374
- ic_callout = gr.HTML()
 
 
 
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
- sort_dropdown_icap = gr.Dropdown(
384
- choices=["Low to High", "High to Low"],
385
- label="Sort",
386
- value="Low to High"
387
- )
388
- icap_callout = gr.HTML()
 
 
 
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
- sort_dropdown_sum = gr.Dropdown(
398
- choices=["Low to High", "High to Low"],
399
- label="Sort",
400
- value="Low to High"
401
- )
402
- sum_callout = gr.HTML()
 
 
 
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
- sort_dropdown_asr = gr.Dropdown(
412
- choices=["Low to High", "High to Low"],
413
- label="Sort",
414
- value="Low to High"
415
- )
416
- asr_callout = gr.HTML()
 
 
 
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
- sort_dropdown_od = gr.Dropdown(
426
- choices=["Low to High", "High to Low"],
427
- label="Sort",
428
- value="Low to High"
429
- )
430
- od_callout = gr.HTML()
 
 
 
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
- sort_dropdown_ss = gr.Dropdown(
440
- choices=["Low to High", "High to Low"],
441
- label="Sort",
442
- value="Low to High"
443
- )
444
- ss_callout = gr.HTML()
 
 
 
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
- sort_dropdown_qa = gr.Dropdown(
454
- choices=["Low to High", "High to Low"],
455
- label="Sort",
456
- value="Low to High"
457
- )
458
- qa_callout = gr.HTML()
 
 
 
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
- sort_dropdown_all = gr.Dropdown(
468
- choices=["Low to High", "High to Low"],
469
- label="Sort",
470
- value="Low to High"
471
- )
472
- all_callout = gr.HTML()
 
 
 
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