Jerrycool commited on
Commit
9e69318
·
verified ·
1 Parent(s): 079d6b6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +43 -40
app.py CHANGED
@@ -7,6 +7,7 @@ Changes made in this version
7
  2. **Introduced a single, clean rule‑set** for the introduction block so the
8
  font size, family and alignment are now reliably applied.
9
  3. All new comments are in English for clarity.
 
10
  """
11
 
12
  import gradio as gr
@@ -24,7 +25,7 @@ try:
24
  EVALUATION_QUEUE_TEXT, # still referenced in commented‑out submit tab
25
  INTRODUCTION_TEXT,
26
  LLM_BENCHMARKS_TEXT,
27
- TITLE, # contains <h1 id="main-leaderboard-title">
28
  )
29
 
30
  try:
@@ -43,7 +44,7 @@ except ImportError:
43
  EVALUATION_QUEUE_TEXT = "Current evaluation queue:"
44
  TITLE = (
45
  "<h1 id=\"main-leaderboard-title\" align=\"center\">🏆 MLE-Dojo "
46
- "Benchmark Leaderboard (Placeholder)</h1>"
47
  )
48
  INTRODUCTION_TEXT = (
49
  "<div class=\"introduction-section\">"
@@ -190,11 +191,11 @@ def update_leaderboard(category: str) -> pd.DataFrame:
190
  )
191
 
192
  df = df.rename(columns={
193
- score_column: "Elo Score",
194
  "organizer": "Organizer",
195
  "license": "License",
196
  })
197
- return df[["Rank", "Model", "Organizer", "License", "Elo Score"]]
198
 
199
  # ---------------------------------------------------------------------------
200
  # Basic placeholder DataFrames for the (currently disabled) evaluation queue
@@ -203,11 +204,11 @@ print("Warning: evaluation queue fetching is disabled/mocked.")
203
  empty_queue_df = pd.DataFrame(columns=["Model", "Status", "Requested", "Started"])
204
 
205
  # ---------------------------------------------------------------------------
206
- # Helper for HF Spaces restart (optional)
207
  # ---------------------------------------------------------------------------
208
 
209
  def restart_space():
210
- """Restart the current Hugging Face Space (if running in one)."""
211
  print(f"Attempting to restart space: {REPO_ID}")
212
  # Insert actual restart logic if needed.
213
 
@@ -222,7 +223,7 @@ intro_css = """
222
  -------------------------------------------------- */
223
  .introduction-wrapper, .introduction-section {
224
  font-family: Arial;
225
- font-size: 1.3rem !important; /* ≈22–23 px */
226
  line-height: 1.75;
227
  color: #344054;
228
  text-align: center;
@@ -230,7 +231,7 @@ intro_css = """
230
  margin: 0 auto 1rem auto;
231
  }
232
  .introduction-wrapper p, .introduction-section p {
233
- font-size: 1.3rem !important; /* ≈22–23 px */
234
  margin-bottom: 0.5rem;
235
  }
236
  @media (max-width: 768px) {
@@ -288,21 +289,21 @@ body {
288
 
289
  #leaderboard-table {
290
  border-radius: 0.75rem;
291
- overflow: hidden;
292
- border: 1px solid #dee2e6;
293
  }
294
 
295
  #leaderboard-table th,
296
  #leaderboard-table td {
297
- padding: 0.9rem 1.2rem;
298
- line-height: 1.4;
299
  }
300
 
301
  #intro-image img {
302
  max-width: 800px;
303
  height: auto;
304
  display: block;
305
- margin: 0 auto;
306
  }
307
  """
308
 
@@ -312,8 +313,8 @@ markdown_css = """
312
  =============================== */
313
  .markdown-text, .markdown-text p {
314
  font-family: Arial, Helvetica, sans-serif;
315
- font-size: 1.1rem;
316
- line-height: 1.75;
317
  color: #344054;
318
  margin-bottom: 0.9rem;
319
  }
@@ -369,9 +370,9 @@ tab_css = """
369
  .tabs .tab-container > button {
370
  /* Add your desired styles here */
371
  font-size: 1.6rem !important; /* Example: Adjust size */
372
- font-weight: 500; /* Example: Adjust weight */
373
- font-style: normal; /* Example: Set style */
374
- color: #333; /* Example: Set color */
375
  /* Add any other font/format properties */
376
  }
377
 
@@ -382,12 +383,13 @@ tab_css = """
382
  }
383
  """
384
 
 
385
  radio_css = """
386
  /* --- Radio Button Styling --- */
387
 
388
  /* Style for the main label ("Select Category:") */
389
  .gradio-radio > label span { /* This targets the "Select Category:" part */
390
- font-size: 1.2rem !important;
391
  font-weight: 600;
392
  color: #2a6099;
393
  padding-bottom: 8px;
@@ -395,8 +397,8 @@ radio_css = """
395
  }
396
 
397
  /* Style for the individual option labels (Overall, MLE-Lite, etc.) */
398
- .gradio-radio .wrap > label > span { /* <--- ADDED/UPDATED RULE */
399
- font-size: 1.2rem !important;
400
  font-family: Verdana, Geneva, sans-serif;
401
  color: #444;
402
  font-weight: normal;
@@ -405,7 +407,7 @@ radio_css = """
405
  }
406
 
407
  /* Optional: Style for the selected option's text */
408
- .gradio-radio .wrap > label.selected > span { /* <--- ADDED RULE */
409
  font-weight: bold;
410
  color: #111;
411
  }
@@ -419,28 +421,28 @@ citation_css = """
419
  /* Accordion Header Text ("📙 Citation") */
420
  .gradio-accordion button.label-wrap > span.svelte-1w6vloh {
421
  font-size: 1.4rem !important; /* Adjust size */
422
- font-weight: 600; /* Adjust weight */
423
- color: #8B4513; /* Adjust color (SaddleBrown example) */
424
- font-family: Georgia, serif; /* Adjust font */
425
  }
426
 
427
  /* Citation Textbox Label ("Copy the following snippet...") */
428
  #citation-button span.svelte-1gfkn6j {
429
  font-size: 0.95rem !important; /* Adjust size */
430
- color: #666; /* Adjust color */
431
- font-style: normal; /* Adjust style (e.g., italic) */
432
- display: block; /* Make it a block to add margin */
433
- margin-bottom: 5px; /* Add space below label */
434
  }
435
 
436
  /* Citation Textbox Content (The actual text) */
437
  #citation-button textarea {
438
  font-size: 1.0rem !important; /* Adjust size */
439
  font-family: monospace; /* Adjust font (monospace often used for citations) */
440
- color: #222; /* Adjust text color */
441
- line-height: 1.6; /* Adjust line spacing */
442
- background-color: #fdfdfd; /* Adjust background color */
443
- border: 1px solid #ccc; /* Adjust border */
444
  }
445
  """
446
 
@@ -464,28 +466,29 @@ with demo:
464
  # NEW ⭐: image immediately below the introduction
465
  # with gr.Row():
466
  # gr.Image(
467
- # value="overview.jpg",
468
- # show_label=False,
469
- # elem_id="intro-image",
470
  # )
471
 
472
  with gr.Tabs(elem_classes="tab-buttons"):
473
  # ------------------ Leaderboard tab ------------------
474
  with gr.TabItem("🏅 MLE-Dojo Benchmark", id=0):
475
  with gr.Column():
 
476
  gr.Markdown("## Model Elo Rankings by Category", elem_classes="markdown-text")
477
 
478
  category_selector = gr.Radio(
479
  choices=CATEGORIES,
480
- label="Select Category:",
481
  value=DEFAULT_CATEGORY,
482
  interactive=True,
483
- elem_classes="gradio-radio",
484
  )
485
 
486
  leaderboard_df_component = gr.Dataframe(
487
  value=update_leaderboard(DEFAULT_CATEGORY),
488
- headers=["Rank", "Model", "Organizer", "License", "Elo Score"],
489
  datatype=["number", "html", "str", "str", "number"],
490
  interactive=False,
491
  row_count=(len(master_df), "fixed"),
@@ -528,4 +531,4 @@ if __name__ == "__main__":
528
  print(f"Scheduler init failed: {exc}")
529
 
530
  print("Launching Gradio app…")
531
- demo.launch()
 
7
  2. **Introduced a single, clean rule‑set** for the introduction block so the
8
  font size, family and alignment are now reliably applied.
9
  3. All new comments are in English for clarity.
10
+ 4. Adjusted font sizes for Radio button labels per user request.
11
  """
12
 
13
  import gradio as gr
 
25
  EVALUATION_QUEUE_TEXT, # still referenced in commented‑out submit tab
26
  INTRODUCTION_TEXT,
27
  LLM_BENCHMARKS_TEXT,
28
+ TITLE, # contains <h1 id="main-leaderboard-title">
29
  )
30
 
31
  try:
 
44
  EVALUATION_QUEUE_TEXT = "Current evaluation queue:"
45
  TITLE = (
46
  "<h1 id=\"main-leaderboard-title\" align=\"center\">🏆 MLE-Dojo "
47
+ "Benchmark Leaderboard (Placeholder)</h1>"
48
  )
49
  INTRODUCTION_TEXT = (
50
  "<div class=\"introduction-section\">"
 
191
  )
192
 
193
  df = df.rename(columns={
194
+ score_column: "Elo Score",
195
  "organizer": "Organizer",
196
  "license": "License",
197
  })
198
+ return df[["Rank", "Model", "Organizer", "License", "Elo Score"]]
199
 
200
  # ---------------------------------------------------------------------------
201
  # Basic placeholder DataFrames for the (currently disabled) evaluation queue
 
204
  empty_queue_df = pd.DataFrame(columns=["Model", "Status", "Requested", "Started"])
205
 
206
  # ---------------------------------------------------------------------------
207
+ # Helper for HF Spaces restart (optional)
208
  # ---------------------------------------------------------------------------
209
 
210
  def restart_space():
211
+ """Restart the current Hugging Face Space (if running in one)."""
212
  print(f"Attempting to restart space: {REPO_ID}")
213
  # Insert actual restart logic if needed.
214
 
 
223
  -------------------------------------------------- */
224
  .introduction-wrapper, .introduction-section {
225
  font-family: Arial;
226
+ font-size: 1.3rem !important; /* ≈22–23 px */
227
  line-height: 1.75;
228
  color: #344054;
229
  text-align: center;
 
231
  margin: 0 auto 1rem auto;
232
  }
233
  .introduction-wrapper p, .introduction-section p {
234
+ font-size: 1.3rem !important; /* ≈22–23 px */
235
  margin-bottom: 0.5rem;
236
  }
237
  @media (max-width: 768px) {
 
289
 
290
  #leaderboard-table {
291
  border-radius: 0.75rem;
292
+ overflow: hidden;
293
+ border: 1px solid #dee2e6;
294
  }
295
 
296
  #leaderboard-table th,
297
  #leaderboard-table td {
298
+ padding: 0.9rem 1.2rem;
299
+ line-height: 1.4;
300
  }
301
 
302
  #intro-image img {
303
  max-width: 800px;
304
  height: auto;
305
  display: block;
306
+ margin: 0 auto;
307
  }
308
  """
309
 
 
313
  =============================== */
314
  .markdown-text, .markdown-text p {
315
  font-family: Arial, Helvetica, sans-serif;
316
+ font-size: 1.1rem;
317
+ line-height: 1.75;
318
  color: #344054;
319
  margin-bottom: 0.9rem;
320
  }
 
370
  .tabs .tab-container > button {
371
  /* Add your desired styles here */
372
  font-size: 1.6rem !important; /* Example: Adjust size */
373
+ font-weight: 500; /* Example: Adjust weight */
374
+ font-style: normal; /* Example: Set style */
375
+ color: #333; /* Example: Set color */
376
  /* Add any other font/format properties */
377
  }
378
 
 
383
  }
384
  """
385
 
386
+ # --- MODIFIED CSS FOR RADIO BUTTONS ---
387
  radio_css = """
388
  /* --- Radio Button Styling --- */
389
 
390
  /* Style for the main label ("Select Category:") */
391
  .gradio-radio > label span { /* This targets the "Select Category:" part */
392
+ font-size: 1.5rem !important; /* <<< INCREASED from 1.2rem */
393
  font-weight: 600;
394
  color: #2a6099;
395
  padding-bottom: 8px;
 
397
  }
398
 
399
  /* Style for the individual option labels (Overall, MLE-Lite, etc.) */
400
+ .gradio-radio .wrap > label > span { /* <--- Targets the individual option text */
401
+ font-size: 1.0rem !important; /* <<< DECREASED from 1.2rem */
402
  font-family: Verdana, Geneva, sans-serif;
403
  color: #444;
404
  font-weight: normal;
 
407
  }
408
 
409
  /* Optional: Style for the selected option's text */
410
+ .gradio-radio .wrap > label.selected > span { /* <--- Style for selected option */
411
  font-weight: bold;
412
  color: #111;
413
  }
 
421
  /* Accordion Header Text ("📙 Citation") */
422
  .gradio-accordion button.label-wrap > span.svelte-1w6vloh {
423
  font-size: 1.4rem !important; /* Adjust size */
424
+ font-weight: 600; /* Adjust weight */
425
+ color: #8B4513; /* Adjust color (SaddleBrown example) */
426
+ font-family: Georgia, serif; /* Adjust font */
427
  }
428
 
429
  /* Citation Textbox Label ("Copy the following snippet...") */
430
  #citation-button span.svelte-1gfkn6j {
431
  font-size: 0.95rem !important; /* Adjust size */
432
+ color: #666; /* Adjust color */
433
+ font-style: normal; /* Adjust style (e.g., italic) */
434
+ display: block; /* Make it a block to add margin */
435
+ margin-bottom: 5px; /* Add space below label */
436
  }
437
 
438
  /* Citation Textbox Content (The actual text) */
439
  #citation-button textarea {
440
  font-size: 1.0rem !important; /* Adjust size */
441
  font-family: monospace; /* Adjust font (monospace often used for citations) */
442
+ color: #222; /* Adjust text color */
443
+ line-height: 1.6; /* Adjust line spacing */
444
+ background-color: #fdfdfd; /* Adjust background color */
445
+ border: 1px solid #ccc; /* Adjust border */
446
  }
447
  """
448
 
 
466
  # NEW ⭐: image immediately below the introduction
467
  # with gr.Row():
468
  # gr.Image(
469
+ # value="overview.jpg",
470
+ # show_label=False,
471
+ # elem_id="intro-image",
472
  # )
473
 
474
  with gr.Tabs(elem_classes="tab-buttons"):
475
  # ------------------ Leaderboard tab ------------------
476
  with gr.TabItem("🏅 MLE-Dojo Benchmark", id=0):
477
  with gr.Column():
478
+ # --- This is the title you mentioned. "虚拟" is not present here. ---
479
  gr.Markdown("## Model Elo Rankings by Category", elem_classes="markdown-text")
480
 
481
  category_selector = gr.Radio(
482
  choices=CATEGORIES,
483
+ label="Select Category:", # The label whose size is increased via CSS
484
  value=DEFAULT_CATEGORY,
485
  interactive=True,
486
+ elem_classes="gradio-radio", # Class used for CSS targeting
487
  )
488
 
489
  leaderboard_df_component = gr.Dataframe(
490
  value=update_leaderboard(DEFAULT_CATEGORY),
491
+ headers=["Rank", "Model", "Organizer", "License", "Elo Score"],
492
  datatype=["number", "html", "str", "str", "number"],
493
  interactive=False,
494
  row_count=(len(master_df), "fixed"),
 
531
  print(f"Scheduler init failed: {exc}")
532
 
533
  print("Launching Gradio app…")
534
+ demo.launch()