Spaces:
Running
Running
File size: 29,320 Bytes
e7cbd6a 2cd90e2 e7cbd6a 2cd90e2 c5ebe65 47d601f 2cd90e2 e7cbd6a 2cd90e2 47d601f 2cd90e2 47d601f 2caedfe 2cd90e2 b454a71 2cd90e2 2caedfe 2cd90e2 47d601f 07c3310 2cd90e2 295d728 47d601f 2caedfe 47d601f 2cd90e2 bc9e568 2cd90e2 295d728 20d2b71 2cd90e2 47d601f 2cd90e2 c564ff8 2cd90e2 2caedfe 20d2b71 2caedfe 47d601f 2caedfe 47d601f 2caedfe 47d601f 2caedfe be5dffd 47d601f bc9e568 e60e5e0 07c3310 47d601f e60e5e0 bc9e568 2caedfe c6df42e 20d2b71 c6df42e 2caedfe be5dffd bc9e568 c6df42e 2cd90e2 20d2b71 2cd90e2 e7cbd6a 5dc7166 2cd90e2 8fa8434 2cd90e2 352fe6c fe6b2ac 2cd90e2 5dc7166 bc9e568 2cd90e2 47d601f 2cd90e2 2caedfe 47d601f 2caedfe 47d601f 2caedfe b0ca63c 6ed83d7 2caedfe 2cd90e2 47d601f 2cd90e2 2caedfe 47d601f 2caedfe be5dffd 2caedfe 2cd90e2 2caedfe 47d601f 2caedfe be5dffd 2caedfe 2cd90e2 2caedfe 47d601f 2caedfe be5dffd 2caedfe 2cd90e2 2caedfe 47d601f 2caedfe be5dffd 2caedfe 2cd90e2 2caedfe 47d601f 2caedfe be5dffd 2caedfe 2cd90e2 2caedfe 47d601f 2caedfe be5dffd 2caedfe 2cd90e2 2caedfe 47d601f 2caedfe be5dffd 2caedfe 2cd90e2 2caedfe 47d601f 2caedfe be5dffd 2caedfe 2cd90e2 2caedfe 47d601f 2caedfe be5dffd 2caedfe 2cd90e2 2caedfe 20d2b71 2caedfe 47d601f 2caedfe 47d601f 2caedfe 47d601f 2caedfe be5dffd 2caedfe 07c3310 2cd90e2 07c3310 20d2b71 07c3310 e60e5e0 20d2b71 b0ca63c 07c3310 b0ca63c 352fe6c 2cd90e2 352fe6c 2cd90e2 c564ff8 295d728 c564ff8 07c3310 352fe6c 07c3310 dd445b6 352fe6c 07c3310 352fe6c dd445b6 352fe6c dd445b6 07c3310 352fe6c 07c3310 dd445b6 352fe6c 07c3310 b0ca63c 07c3310 b0ca63c 07c3310 2cd90e2 e60e5e0 20d2b71 c564ff8 352fe6c c564ff8 352fe6c c6df42e 20d2b71 e60e5e0 20d2b71 e60e5e0 2cd90e2 07c3310 2cd90e2 be5dffd d4f7fe0 20d2b71 be5dffd 20d2b71 d4f7fe0 47d601f d4f7fe0 2caedfe 47d601f 2caedfe 47d601f 2cd90e2 47d601f e60e5e0 2cd90e2 d4f7fe0 20d2b71 d4f7fe0 2caedfe 2cd90e2 e60e5e0 2cd90e2 d4f7fe0 20d2b71 d4f7fe0 2caedfe 2cd90e2 e60e5e0 2cd90e2 d4f7fe0 20d2b71 d4f7fe0 2caedfe 2cd90e2 e60e5e0 2cd90e2 d4f7fe0 20d2b71 d4f7fe0 2caedfe 2cd90e2 e60e5e0 2cd90e2 d4f7fe0 20d2b71 d4f7fe0 2caedfe 2cd90e2 e60e5e0 2cd90e2 d4f7fe0 20d2b71 d4f7fe0 2caedfe 2cd90e2 e60e5e0 2cd90e2 d4f7fe0 20d2b71 d4f7fe0 2caedfe 2cd90e2 e60e5e0 2cd90e2 d4f7fe0 20d2b71 d4f7fe0 2caedfe 2cd90e2 e60e5e0 2cd90e2 d4f7fe0 20d2b71 d4f7fe0 2caedfe 2cd90e2 e60e5e0 2cd90e2 d4f7fe0 20d2b71 d4f7fe0 2caedfe 2cd90e2 47d601f e7cbd6a 6ed83d7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 |
import gradio as gr
import pandas as pd
import os
import zipfile
import base64
CITATION_BUTTON_LABEL = "Copy the following snippet to cite these results"
CITATION_BUTTON_TEXT = r"""@misc{aienergyscore-leaderboard,
author = {Sasha Luccioni and Boris Gamazaychikov and Emma Strubell and Sara Hooker and Yacine Jernite and Margaret Mitchell and Scott Chamberlin},
title = {AI Energy Score Leaderboard - December 2025},
year = {2025},
publisher = {Hugging Face},
howpublished = "\url{https://huggingface.co/spaces/AIEnergyScore/Leaderboard}",
}"""
# List of tasks (CSV filenames)
tasks = [
'asr.csv',
'object_detection.csv',
'text_classification.csv',
'reasoning.csv',
'image_captioning.csv',
'question_answering.csv',
'text_generation.csv',
'image_classification.csv',
'sentence_similarity.csv',
'image_generation.csv',
'summarization.csv'
]
# Mapping for display names in "All Tasks"
TASK_NAME_MAPPING = {
'text_generation.csv': 'Text Generation π¬',
'reasoning.csv': 'Reasoning π§ ',
'image_generation.csv': 'Image Generation π·',
'text_classification.csv': 'Text Classification π',
'image_classification.csv': 'Image Classification πΌοΈ',
'image_captioning.csv': 'Image Captioning π',
'summarization.csv': 'Summarization π',
'asr.csv': 'Automatic Speech Recognition π¬',
'object_detection.csv': 'Object Detection π',
'sentence_similarity.csv': 'Sentence Similarity π',
'question_answering.csv': 'Extractive QA β'
}
### HELPER FUNCTIONS ###
def format_stars(score):
try:
score_int = int(score)
except Exception:
score_int = 0
return f'<span style="color: #3fa45bff; font-size:1.5em;">{"β
" * score_int}</span>'
def make_link(mname):
parts = str(mname).split('/')
display_name = parts[1] if len(parts) > 1 else mname
return f'<a href="https://huggingface.co/{mname}" target="_blank">{display_name}</a>'
def extract_link_text(html_link):
start = html_link.find('>') + 1
end = html_link.rfind('</a>')
if start > 0 and end > start:
return html_link[start:end]
else:
return html_link
def generate_html_table_from_df(df):
# Compute a static width for the Model column based on the longest model name.
if not df.empty:
max_length = max(len(extract_link_text(link)) for link in df['Model'])
else:
max_length = 10
static_width = max_length * 10 + 16
max_energy = df['gpu_energy_numeric'].max() if not df.empty else 1
color_map = {"1": "black", "2": "black", "3": "black", "4": "black", "5": "black"}
task_name = df.attrs.get("task_name", "")
# Check if we should display the 'Task' column (only for All Tasks view)
has_task_column = 'Task' in df.columns
if task_name not in ["text_generation.csv", "reasoning.csv"]:
has_test_date = True
df["test date"] = "Feb 25"
else:
has_test_date = ('test date' in df.columns or 'Test Date' in df.columns)
if 'Test Date' in df.columns and 'test date' not in df.columns:
df = df.rename(columns={'Test Date':'test date'})
html = '<table class="data-table" style="width:100%; border-collapse: collapse; font-family: Inter, sans-serif;">'
html += '<thead><tr style="background-color: #f2f2f2;">'
html += '<th style="text-align: left; padding: 8px;" title="Model name with link to Hugging Face">Model</th>'
html += '<th style="text-align: left; padding: 8px;" title="AI Provider extracted from the model name">Provider</th>'
html += '<th style="text-align: left; padding: 8px;" title="GPU energy consumed in Watt-hours for 1,000 queries">GPU Energy (Wh) per 1k Queries</th>'
html += '<th style="text-align: left; padding: 8px;" title="Energy efficiency score (stars)">Score</th>'
if has_task_column:
html += '<th style="text-align: left; padding: 8px;" title="Task Category">Task</th>'
if has_test_date:
html += '<th style="text-align: left; padding: 8px;" title="Benchmark test date">Test Date</th>'
html += '</tr></thead>'
html += '<tbody>'
for _, row in df.iterrows():
energy_numeric = row['gpu_energy_numeric']
energy_str = f"{energy_numeric:,.2f}"
bar_width = (energy_numeric / max_energy) * 100
score_val = row['energy_score']
bar_color = color_map.get(str(score_val), "gray")
html += '<tr>'
html += f'<td style="padding: 8px; width: {static_width}px;">{row["Model"]}</td>'
html += f'<td style="padding: 8px;">{row["Provider"]}</td>'
html += (f'<td style="padding: 8px;">{energy_str}<br>'
f'<div style="background-color: {bar_color}; width: {bar_width:.1f}%; height: 10px;"></div></td>')
html += f'<td style="padding: 8px;">{row["Score"]}</td>'
if has_task_column:
html += f'<td style="padding: 8px;">{row["Task"]}</td>'
if has_test_date:
td = row.get('test date', row.get('Test Date', ''))
html += f'<td style="padding: 8px;">{td}</td>'
html += '</tr>'
html += '</tbody></table>'
return f'<div class="table-container">{html}</div>'
def process_df(task, sort_order="Low to High", filter_fn=None):
df = pd.read_csv(os.path.join("data", "energy", task))
if df.columns[0].startswith("Unnamed:"):
df = df.iloc[:, 1:]
df['energy_score'] = pd.to_numeric(df['energy_score'], errors='coerce').fillna(0).clip(lower=0, upper=5).astype(int)
# Using raw numbers, no pre-rounding
df['gpu_energy_numeric'] = pd.to_numeric(df['total_gpu_energy'], errors='coerce').fillna(0.0) * 1000
# normalize test date header if present
if 'Test Date' in df.columns and 'test date' not in df.columns:
df = df.rename(columns={'Test Date':'test date'})
if 'test_date' in df.columns and 'test date' not in df.columns:
df = df.rename(columns={'test_date':'test date'})
if 'test date' in df.columns:
df['test date'] = df['test date'].astype(str).str.strip()
if filter_fn is not None:
df = filter_fn(df)
df['Provider'] = df['model'].apply(lambda x: str(x).split('/')[0])
df['Model'] = df['model'].apply(make_link)
df['Score'] = df['energy_score'].apply(format_stars)
ascending = True if sort_order == "Low to High" else False
df = df.sort_values(by='gpu_energy_numeric', ascending=ascending)
return df
def get_test_date_choices(task_filename):
try:
df = pd.read_csv(os.path.join("data","energy", task_filename))
if df.columns[0].startswith("Unnamed:"):
df = df.iloc[:,1:]
if 'Test Date' in df.columns and 'test date' not in df.columns:
df = df.rename(columns={'Test Date':'test date'})
if 'test_date' in df.columns and 'test date' not in df.columns:
df = df.rename(columns={'test_date':'test date'})
if 'test date' in df.columns:
return sorted([d for d in df['test date'].astype(str).str.strip().unique().tolist() if d])
return []
except Exception:
return []
def compute_efficiency_ratio(df):
if df.empty:
return 1
# Use unrounded raw numbers for calculation
min_val = df['gpu_energy_numeric'].min()
max_val = df['gpu_energy_numeric'].max()
ratio = max_val / min_val if min_val > 0 else 1
return ratio
def generate_info_callout(ratio, scope_text):
# Rounded to no decimals (.0f) for display
return (
f'<div style="text-align: right;">'
f'<div class="info-callout" style="display:inline-block; max-width:250px; font-size:0.8em; background-color:#e6ffe6; padding:8px; border-radius:5px;">'
f'π‘ There\'s a <strong style="color: black !important;">{ratio:,.0f}x</strong> difference between the highest and lowest energy use in {scope_text}.'
f'</div></div>'
)
def get_global_callout():
all_df = pd.DataFrame()
for task in tasks:
df = pd.read_csv(os.path.join("data", "energy", task))
if df.columns[0].startswith("Unnamed:"):
df = df.iloc[:, 1:]
df['gpu_energy_numeric'] = pd.to_numeric(df['total_gpu_energy'], errors='raise') * 1000
all_df = pd.concat([all_df, df], ignore_index=True)
ratio = compute_efficiency_ratio(all_df)
return generate_info_callout(ratio, "this leaderboard")
### ZIP DOWNLOAD FUNCTIONS ###
def zip_csv_files():
data_dir = os.path.join("data", "energy")
zip_filename = "data.zip"
with zipfile.ZipFile(zip_filename, "w", zipfile.ZIP_DEFLATED) as zipf:
for filename in os.listdir(data_dir):
if filename.endswith(".csv"):
filepath = os.path.join(data_dir, filename)
zipf.write(filepath, arcname=filename)
return zip_filename
def get_zip_data_link():
zip_filename = zip_csv_files()
with open(zip_filename, "rb") as f:
data = f.read()
b64 = base64.b64encode(data).decode()
href = (
f'<a class="header-link" href="data:application/zip;base64,{b64}" '
'download="data.zip" '
'style="text-decoration: none; font-weight: bold; font-size: 1.1em; color: inherit; font-family: \'Inter\', sans-serif;">Download Data</a>'
)
return href
### UPDATE FUNCTIONS (RETURNING CALLOUT AND TABLE HTML) ###
def update_text_generation(selected_display, sort_order, selected_dates):
mapping = {
"A (Single Consumer GPU) <20B parameters": "A",
"B (Single Cloud GPU) 20-66B parameters": "B",
"C (Multiple Cloud GPUs) >66B parameters": "C"
}
model_class = mapping.get(selected_display, "A")
def filter_fn(df):
# filter by selected test dates as well
if 'Test Date' in df.columns and 'test date' not in df.columns:
df.rename(columns={'Test Date':'test date'}, inplace=True)
if 'test_date' in df.columns and 'test date' not in df.columns:
df.rename(columns={'test_date':'test date'}, inplace=True)
if selected_dates:
df = df[df['test date'].astype(str).isin(selected_dates)]
if 'class' in df.columns:
return df[df['class'] == model_class]
return df
df = process_df('text_generation.csv', sort_order, filter_fn)
df.attrs["task_name"] = "text_generation.csv"
ratio = compute_efficiency_ratio(df)
# For Text Generation, use "this class" as the scope.
callout = generate_info_callout(ratio, "this class")
table_html = generate_html_table_from_df(df)
return callout, table_html
def update_reasoning(selected_display, sort_order):
mapping = {
"A (Single Consumer GPU) <20B parameters": "A",
"B (Single Cloud GPU) 20-66B parameters": "B",
"C (Multiple Cloud GPUs) >66B parameters": "C"
}
model_class = mapping.get(selected_display, "A")
def filter_fn(df):
# class-only filter; no test-date filtering for Reasoning
if 'class' in df.columns:
df = df[df['class'] == model_class]
return df
df = process_df('reasoning.csv', sort_order, filter_fn)
df.attrs["task_name"] = "reasoning.csv"
ratio = compute_efficiency_ratio(df)
callout = generate_info_callout(ratio, "this class")
table_html = generate_html_table_from_df(df)
return callout, table_html
def update_image_generation(sort_order):
df = process_df('image_generation.csv', sort_order)
df.attrs["task_name"] = 'image_generation.csv'
ratio = compute_efficiency_ratio(df)
callout = generate_info_callout(ratio, "this task")
table_html = generate_html_table_from_df(df)
return callout, table_html
def update_text_classification(sort_order):
df = process_df('text_classification.csv', sort_order)
df.attrs["task_name"] = 'text_classification.csv'
ratio = compute_efficiency_ratio(df)
callout = generate_info_callout(ratio, "this task")
table_html = generate_html_table_from_df(df)
return callout, table_html
def update_image_classification(sort_order):
df = process_df('image_classification.csv', sort_order)
df.attrs["task_name"] = 'image_classification.csv'
ratio = compute_efficiency_ratio(df)
callout = generate_info_callout(ratio, "this task")
table_html = generate_html_table_from_df(df)
return callout, table_html
def update_image_captioning(sort_order):
df = process_df('image_captioning.csv', sort_order)
df.attrs["task_name"] = 'image_captioning.csv'
ratio = compute_efficiency_ratio(df)
callout = generate_info_callout(ratio, "this task")
table_html = generate_html_table_from_df(df)
return callout, table_html
def update_summarization(sort_order):
df = process_df('summarization.csv', sort_order)
df.attrs["task_name"] = 'summarization.csv'
ratio = compute_efficiency_ratio(df)
callout = generate_info_callout(ratio, "this task")
table_html = generate_html_table_from_df(df)
return callout, table_html
def update_asr(sort_order):
df = process_df('asr.csv', sort_order)
df.attrs["task_name"] = 'asr.csv'
ratio = compute_efficiency_ratio(df)
callout = generate_info_callout(ratio, "this task")
table_html = generate_html_table_from_df(df)
return callout, table_html
def update_object_detection(sort_order):
df = process_df('object_detection.csv', sort_order)
df.attrs["task_name"] = 'object_detection.csv'
ratio = compute_efficiency_ratio(df)
callout = generate_info_callout(ratio, "this task")
table_html = generate_html_table_from_df(df)
return callout, table_html
def update_sentence_similarity(sort_order):
df = process_df('sentence_similarity.csv', sort_order)
df.attrs["task_name"] = 'sentence_similarity.csv'
ratio = compute_efficiency_ratio(df)
callout = generate_info_callout(ratio, "this task")
table_html = generate_html_table_from_df(df)
return callout, table_html
def update_extractive_qa(sort_order):
df = process_df('question_answering.csv', sort_order)
df.attrs["task_name"] = 'question_answering.csv'
ratio = compute_efficiency_ratio(df)
callout = generate_info_callout(ratio, "this task")
table_html = generate_html_table_from_df(df)
return callout, table_html
def update_all_tasks(sort_order):
all_df = pd.DataFrame()
for task in tasks:
df = pd.read_csv(os.path.join("data", "energy", task))
if df.columns[0].startswith("Unnamed:"):
df = df.iloc[:, 1:]
df['energy_score'] = pd.to_numeric(df['energy_score'], errors='coerce').fillna(0).clip(lower=0, upper=5).astype(int)
df['gpu_energy_numeric'] = pd.to_numeric(df['total_gpu_energy'], errors='coerce').fillna(0.0) * 1000
df['Provider'] = df['model'].apply(lambda x: str(x).split('/')[0])
df['Model'] = df['model'].apply(make_link)
df['Score'] = df['energy_score'].apply(format_stars)
# Add Task column with emoji
df['Task'] = TASK_NAME_MAPPING.get(task, task)
all_df = pd.concat([all_df, df], ignore_index=True)
all_df = all_df.drop_duplicates(subset=['model'])
ascending = True if sort_order == "Low to High" else False
all_df = all_df.sort_values(by='gpu_energy_numeric', ascending=ascending)
ratio = compute_efficiency_ratio(all_df)
callout = generate_info_callout(ratio, "this leaderboard")
table_html = generate_html_table_from_df(all_df)
return callout, table_html
### GLOBAL HEADER (Logo & Global Callout) ###
# Use a <picture> element so that dark mode uses logodark.png.
global_header_html = f"""
<div style="position: relative; width: 100%; text-align: center; margin-bottom: 20px;">
<picture style="display:inline-block;">
<source media="(prefers-color-scheme: dark)" srcset="https://huggingface.co/spaces/AIEnergyScore/Leaderboard/resolve/main/logodark.png">
<img src="https://huggingface.co/spaces/AIEnergyScore/Leaderboard/resolve/main/logo.png"
alt="Logo"
style="width:300px; max-width:300px; height:auto; display:inline-block;">
</picture>
<div style="position: absolute; top: 50%; right: 20px; transform: translateY(-50%);">
{get_global_callout()}
</div>
</div>
"""
### CUSTOM CSS for Dark Mode and Mobile Responsiveness ###
custom_css = """
/* Table and layout */
.data-table {
table-layout: fixed;
width: 100%;
}
.data-table th, .data-table td {
max-width: 150px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.table-container {
width: 100%;
margin-left: auto;
margin-right: auto;
}
/* Force header links to be black in light mode */
.header-link {
color: black !important;
}
/* Dark mode styles */
@media (prefers-color-scheme: dark) {
body {
background-color: #121212;
color: #e0e0e0;
}
/* Make header links white */
.header-link {
color: white !important;
}
.data-table thead {
background-color: #333;
}
/* Make table header text black in dark mode */
.data-table th {
color: black !important;
}
.data-table td {
color: #e0e0e0;
}
/* Make callout text black */
.info-callout {
color: black !important;
}
/* Non-header links in dark mode */
a:not(.header-link) {
color: #3fa45bff !important;
}
}
/* Mobile styles: hide callout boxes on small screens */
@media (max-width: 600px) {
.info-callout {
display: none !important;
}
}
"""
### GRADIO INTERFACE ###
demo = gr.Blocks(css=custom_css)
with demo:
# --- Header Links ---
gr.HTML(f"""
<div style="display: flex; justify-content: space-evenly; align-items: center; margin-bottom: 20px;">
<a class="header-link" href="https://huggingface.co/spaces/AIEnergyScore/submission_portal" style="text-decoration: none; font-weight: bold; font-size: 1.1em;">Submission Portal</a>
<a class="header-link" href="https://huggingface.co/spaces/AIEnergyScore/Label" style="text-decoration: none; font-weight: bold; font-size: 1.1em;">Label Generator</a>
<a class="header-link" href="https://huggingface.github.io/AIEnergyScore/#faq" style="text-decoration: none; font-weight: bold; font-size: 1.1em;">FAQ</a>
<a class="header-link" href="https://huggingface.github.io/AIEnergyScore/#documentation" style="text-decoration: none; font-weight: bold; font-size: 1.1em;">Documentation</a>
{get_zip_data_link()}
<a class="header-link" href="https://huggingface.co/spaces/AIEnergyScore/README/discussions" style="text-decoration: none; font-weight: bold; font-size: 1.1em;">Community</a>
</div>
""")
# --- Global Header: Centered Logo with Global Callout at Right Edge ---
gr.HTML(global_header_html)
# --- Tabs for the different tasks ---
with gr.Tabs():
# --- Text Generation Tab ---
with gr.TabItem("Text Generation π¬"):
with gr.Row():
with gr.Column(scale=4):
model_class_options = [
"A (Single Consumer GPU) <20B parameters",
"B (Single Cloud GPU) 20-66B parameters",
"C (Multiple Cloud GPUs) >66B parameters"
]
model_class_dropdown = gr.Dropdown(choices=model_class_options, label="Select Model Class", value=model_class_options[0])
with gr.Column(scale=4):
sort_dropdown_tg = gr.Dropdown(choices=["Low to High", "High to Low"], label="Sort", value="Low to High")
with gr.Column(scale=4):
tg_date_choices = get_test_date_choices("text_generation.csv")
date_dropdown_tg = gr.Dropdown(choices=tg_date_choices, value=tg_date_choices, multiselect=True, label="Test Date")
with gr.Column(scale=3):
tg_callout = gr.HTML()
tg_table = gr.HTML()
init_callout, init_table = update_text_generation(model_class_options[0], "Low to High", get_test_date_choices("text_generation.csv"))
tg_callout.value = init_callout
tg_table.value = init_table
model_class_dropdown.change(fn=update_text_generation, inputs=[model_class_dropdown, sort_dropdown_tg, date_dropdown_tg], outputs=[tg_callout, tg_table])
sort_dropdown_tg.change(fn=update_text_generation, inputs=[model_class_dropdown, sort_dropdown_tg, date_dropdown_tg], outputs=[tg_callout, tg_table])
date_dropdown_tg.change(fn=update_text_generation, inputs=[model_class_dropdown, sort_dropdown_tg, date_dropdown_tg], outputs=[tg_callout, tg_table])
# --- Reasoning Tab ---
with gr.TabItem("Reasoning π§ "):
with gr.Row():
with gr.Column(scale=4):
model_class_options = [
"A (Single Consumer GPU) <20B parameters",
"B (Single Cloud GPU) 20-66B parameters",
"C (Multiple Cloud GPUs) >66B parameters"
]
rs_class_dropdown = gr.Dropdown(choices=model_class_options, value=model_class_options[0], label="Select Model Class")
with gr.Column(scale=4):
rs_sort_dropdown = gr.Dropdown(choices=["Low to High", "High to Low"], label="Sort", value="Low to High")
with gr.Column(scale=4):
rs_callout = gr.HTML()
rs_table = gr.HTML()
init_callout, init_table = update_reasoning(model_class_options[0], "Low to High")
rs_callout.value = init_callout
rs_table.value = init_table
rs_class_dropdown.change(fn=update_reasoning, inputs=[rs_class_dropdown, rs_sort_dropdown], outputs=[rs_callout, rs_table])
rs_sort_dropdown.change(fn=update_reasoning, inputs=[rs_class_dropdown, rs_sort_dropdown], outputs=[rs_callout, rs_table])
# --- Image Generation Tab ---
with gr.TabItem("Image Generation π·"):
with gr.Row():
with gr.Column(scale=8):
sort_dropdown_img = gr.Dropdown(choices=["Low to High", "High to Low"], label="Sort", value="Low to High")
with gr.Column(scale=4):
img_callout = gr.HTML()
img_table = gr.HTML()
init_callout, init_table = update_image_generation("Low to High")
img_callout.value = init_callout
img_table.value = init_table
sort_dropdown_img.change(fn=update_image_generation, inputs=sort_dropdown_img, outputs=[img_callout, img_table])
# --- Text Classification Tab ---
with gr.TabItem("Text Classification π"):
with gr.Row():
with gr.Column(scale=8):
sort_dropdown_tc = gr.Dropdown(choices=["Low to High", "High to Low"], label="Sort", value="Low to High")
with gr.Column(scale=4):
tc_callout = gr.HTML()
tc_table = gr.HTML()
init_callout, init_table = update_text_classification("Low to High")
tc_callout.value = init_callout
tc_table.value = init_table
sort_dropdown_tc.change(fn=update_text_classification, inputs=sort_dropdown_tc, outputs=[tc_callout, tc_table])
# --- Image Classification Tab ---
with gr.TabItem("Image Classification πΌοΈ"):
with gr.Row():
with gr.Column(scale=8):
sort_dropdown_ic = gr.Dropdown(choices=["Low to High", "High to Low"], label="Sort", value="Low to High")
with gr.Column(scale=4):
ic_callout = gr.HTML()
ic_table = gr.HTML()
init_callout, init_table = update_image_classification("Low to High")
ic_callout.value = init_callout
ic_table.value = init_table
sort_dropdown_ic.change(fn=update_image_classification, inputs=sort_dropdown_ic, outputs=[ic_callout, ic_table])
# --- Image Captioning Tab ---
with gr.TabItem("Image Captioning π"):
with gr.Row():
with gr.Column(scale=8):
sort_dropdown_icap = gr.Dropdown(choices=["Low to High", "High to Low"], label="Sort", value="Low to High")
with gr.Column(scale=4):
icap_callout = gr.HTML()
icap_table = gr.HTML()
init_callout, init_table = update_image_captioning("Low to High")
icap_callout.value = init_callout
icap_table.value = init_table
sort_dropdown_icap.change(fn=update_image_captioning, inputs=sort_dropdown_icap, outputs=[icap_callout, icap_table])
# --- Summarization Tab ---
with gr.TabItem("Summarization π"):
with gr.Row():
with gr.Column(scale=8):
sort_dropdown_sum = gr.Dropdown(choices=["Low to High", "High to Low"], label="Sort", value="Low to High")
with gr.Column(scale=4):
sum_callout = gr.HTML()
sum_table = gr.HTML()
init_callout, init_table = update_summarization("Low to High")
sum_callout.value = init_callout
sum_table.value = init_table
sort_dropdown_sum.change(fn=update_summarization, inputs=sort_dropdown_sum, outputs=[sum_callout, sum_table])
# --- Automatic Speech Recognition Tab ---
with gr.TabItem("Automatic Speech Recognition π¬"):
with gr.Row():
with gr.Column(scale=8):
sort_dropdown_asr = gr.Dropdown(choices=["Low to High", "High to Low"], label="Sort", value="Low to High")
with gr.Column(scale=4):
asr_callout = gr.HTML()
asr_table = gr.HTML()
init_callout, init_table = update_asr("Low to High")
asr_callout.value = init_callout
asr_table.value = init_table
sort_dropdown_asr.change(fn=update_asr, inputs=sort_dropdown_asr, outputs=[asr_callout, asr_table])
# --- Object Detection Tab ---
with gr.TabItem("Object Detection π"):
with gr.Row():
with gr.Column(scale=8):
sort_dropdown_od = gr.Dropdown(choices=["Low to High", "High to Low"], label="Sort", value="Low to High")
with gr.Column(scale=4):
od_callout = gr.HTML()
od_table = gr.HTML()
init_callout, init_table = update_object_detection("Low to High")
od_callout.value = init_callout
od_table.value = init_table
sort_dropdown_od.change(fn=update_object_detection, inputs=sort_dropdown_od, outputs=[od_callout, od_table])
# --- Sentence Similarity Tab ---
with gr.TabItem("Sentence Similarity π"):
with gr.Row():
with gr.Column(scale=8):
sort_dropdown_ss = gr.Dropdown(choices=["Low to High", "High to Low"], label="Sort", value="Low to High")
with gr.Column(scale=4):
ss_callout = gr.HTML()
ss_table = gr.HTML()
init_callout, init_table = update_sentence_similarity("Low to High")
ss_callout.value = init_callout
ss_table.value = init_table
sort_dropdown_ss.change(fn=update_sentence_similarity, inputs=sort_dropdown_ss, outputs=[ss_callout, ss_table])
# --- Extractive QA Tab ---
with gr.TabItem("Extractive QA β"):
with gr.Row():
with gr.Column(scale=8):
sort_dropdown_qa = gr.Dropdown(choices=["Low to High", "High to Low"], label="Sort", value="Low to High")
with gr.Column(scale=4):
qa_callout = gr.HTML()
qa_table = gr.HTML()
init_callout, init_table = update_extractive_qa("Low to High")
qa_callout.value = init_callout
qa_table.value = init_table
sort_dropdown_qa.change(fn=update_extractive_qa, inputs=sort_dropdown_qa, outputs=[qa_callout, qa_table])
# --- All Tasks Tab ---
with gr.TabItem("All Tasks π‘"):
with gr.Row():
with gr.Column(scale=8):
sort_dropdown_all = gr.Dropdown(choices=["Low to High", "High to Low"], label="Sort", value="Low to High")
with gr.Column(scale=4):
all_callout = gr.HTML()
all_table = gr.HTML()
init_callout, init_table = update_all_tasks("Low to High")
all_callout.value = init_callout
all_table.value = init_table
sort_dropdown_all.change(fn=update_all_tasks, inputs=sort_dropdown_all, outputs=[all_callout, all_table])
with gr.Accordion("π Citation", open=False):
citation_button = gr.Textbox(
value=CITATION_BUTTON_TEXT,
label=CITATION_BUTTON_LABEL,
elem_id="citation-button",
lines=10,
show_copy_button=True,
)
gr.Markdown("Last updated: December 2025")
demo.launch() |