Mike0021 commited on
Commit
a7d7ee9
·
verified ·
1 Parent(s): bd83eb3

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +133 -18
app.py CHANGED
@@ -274,6 +274,46 @@ def simulated_tps(tau, method, baseline_tps, load):
274
  return baseline_tps * tau / (1.0 + overhead) * (1.0 - load_pressure * waste)
275
 
276
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
277
  def metric_cards(target, task, method, baseline_tps, load):
278
  dspark = method_tau(target, "DSpark", task)
279
  dflash = method_tau(target, "DFlash", task)
@@ -317,6 +357,7 @@ def acceptance_bar(target, task):
317
  y=values,
318
  marker_color=[COLORS[method] for method in METHODS],
319
  text=[f"{v:.2f}" for v in values],
 
320
  textposition="outside",
321
  hovertemplate="%{x}<br>Accepted length: %{y:.2f}<extra></extra>",
322
  )
@@ -326,12 +367,9 @@ def acceptance_bar(target, task):
326
  xaxis_title="Draft family",
327
  height=360,
328
  margin=dict(l=35, r=20, t=55, b=35),
329
- paper_bgcolor="rgba(0,0,0,0)",
330
- plot_bgcolor="rgba(0,0,0,0)",
331
- font=dict(color="#dbeafe"),
332
  yaxis=dict(gridcolor="rgba(148,163,184,0.18)", range=[0, max(values) + 1.0]),
333
  )
334
- return fig
335
 
336
 
337
  def acceptance_heatmap(target):
@@ -357,12 +395,9 @@ def acceptance_heatmap(target):
357
  title=f"DeepSpec Table 1 matrix for {target}",
358
  height=405,
359
  margin=dict(l=75, r=25, t=55, b=70),
360
- paper_bgcolor="rgba(0,0,0,0)",
361
- plot_bgcolor="rgba(0,0,0,0)",
362
- font=dict(color="#dbeafe"),
363
  xaxis=dict(tickangle=-30),
364
  )
365
- return fig
366
 
367
 
368
  def production_plot():
@@ -377,6 +412,7 @@ def production_plot():
377
  textposition="top center",
378
  line=dict(color="#14b8a6", width=3),
379
  marker=dict(size=12),
 
380
  hovertemplate="V4-Flash SLA %{x} tok/s/user<br>Throughput uplift %{y}%<extra></extra>",
381
  )
382
  )
@@ -390,6 +426,7 @@ def production_plot():
390
  textposition="top center",
391
  line=dict(color="#f97316", width=3),
392
  marker=dict(size=12),
 
393
  hovertemplate="V4-Pro SLA %{x} tok/s/user<br>Throughput uplift %{y}%<extra></extra>",
394
  )
395
  )
@@ -399,13 +436,10 @@ def production_plot():
399
  yaxis_title="Aggregate throughput uplift vs MTP-1",
400
  height=380,
401
  margin=dict(l=45, r=25, t=55, b=45),
402
- paper_bgcolor="rgba(0,0,0,0)",
403
- plot_bgcolor="rgba(0,0,0,0)",
404
- font=dict(color="#dbeafe"),
405
  yaxis=dict(gridcolor="rgba(148,163,184,0.18)"),
406
  legend=dict(orientation="h", yanchor="bottom", y=1.02, xanchor="left", x=0),
407
  )
408
- return fig
409
 
410
 
411
  def inventory_plot():
@@ -432,13 +466,10 @@ def inventory_plot():
432
  xaxis_title="Target model family",
433
  height=380,
434
  margin=dict(l=45, r=25, t=55, b=45),
435
- paper_bgcolor="rgba(0,0,0,0)",
436
- plot_bgcolor="rgba(0,0,0,0)",
437
- font=dict(color="#dbeafe"),
438
  yaxis=dict(gridcolor="rgba(148,163,184,0.18)"),
439
  legend=dict(orientation="h", yanchor="bottom", y=1.02, xanchor="left", x=0),
440
  )
441
- return fig
442
 
443
 
444
  def architecture_panel():
@@ -593,14 +624,98 @@ CSS = """
593
  --panel: rgba(15, 23, 42, 0.86);
594
  --line: rgba(148, 163, 184, 0.18);
595
  --text: #e5efff;
596
- --muted: #9fb0c8;
597
  }
598
  .gradio-container {
 
 
 
 
 
 
 
 
 
 
 
 
 
599
  background:
600
  radial-gradient(circle at 12% 0%, rgba(20, 184, 166, 0.18), transparent 28%),
601
  linear-gradient(135deg, #070b13 0%, #0f172a 52%, #111827 100%);
602
  color: var(--text);
603
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
604
  .main-shell {
605
  border: 1px solid var(--line);
606
  border-radius: 8px;
@@ -658,7 +773,7 @@ CSS = """
658
  border-radius: 8px;
659
  padding: 14px;
660
  min-height: 118px;
661
- background: rgba(2, 6, 23, 0.42);
662
  position: relative;
663
  overflow: hidden;
664
  }
 
274
  return baseline_tps * tau / (1.0 + overhead) * (1.0 - load_pressure * waste)
275
 
276
 
277
+ def apply_dark_plot_layout(fig):
278
+ fig.update_layout(
279
+ template="plotly_dark",
280
+ paper_bgcolor="#0b1220",
281
+ plot_bgcolor="#0f172a",
282
+ font=dict(color="#e5efff", family="Inter, ui-sans-serif, system-ui, sans-serif"),
283
+ title_font=dict(color="#f8fafc", size=18),
284
+ legend=dict(font=dict(color="#dbeafe")),
285
+ hoverlabel=dict(
286
+ bgcolor="#111827",
287
+ bordercolor="#475569",
288
+ font=dict(color="#f8fafc"),
289
+ ),
290
+ )
291
+ fig.update_xaxes(
292
+ gridcolor="rgba(148, 163, 184, 0.18)",
293
+ zerolinecolor="rgba(148, 163, 184, 0.22)",
294
+ linecolor="rgba(148, 163, 184, 0.34)",
295
+ tickcolor="rgba(148, 163, 184, 0.34)",
296
+ title_font=dict(color="#dbeafe"),
297
+ tickfont=dict(color="#cbd5e1"),
298
+ )
299
+ fig.update_yaxes(
300
+ gridcolor="rgba(148, 163, 184, 0.18)",
301
+ zerolinecolor="rgba(148, 163, 184, 0.22)",
302
+ linecolor="rgba(148, 163, 184, 0.34)",
303
+ tickcolor="rgba(148, 163, 184, 0.34)",
304
+ title_font=dict(color="#dbeafe"),
305
+ tickfont=dict(color="#cbd5e1"),
306
+ )
307
+ fig.update_traces(
308
+ colorbar=dict(
309
+ tickfont=dict(color="#dbeafe"),
310
+ title_font=dict(color="#f8fafc"),
311
+ ),
312
+ selector=dict(type="heatmap"),
313
+ )
314
+ return fig
315
+
316
+
317
  def metric_cards(target, task, method, baseline_tps, load):
318
  dspark = method_tau(target, "DSpark", task)
319
  dflash = method_tau(target, "DFlash", task)
 
357
  y=values,
358
  marker_color=[COLORS[method] for method in METHODS],
359
  text=[f"{v:.2f}" for v in values],
360
+ textfont=dict(color="#f8fafc", size=13),
361
  textposition="outside",
362
  hovertemplate="%{x}<br>Accepted length: %{y:.2f}<extra></extra>",
363
  )
 
367
  xaxis_title="Draft family",
368
  height=360,
369
  margin=dict(l=35, r=20, t=55, b=35),
 
 
 
370
  yaxis=dict(gridcolor="rgba(148,163,184,0.18)", range=[0, max(values) + 1.0]),
371
  )
372
+ return apply_dark_plot_layout(fig)
373
 
374
 
375
  def acceptance_heatmap(target):
 
395
  title=f"DeepSpec Table 1 matrix for {target}",
396
  height=405,
397
  margin=dict(l=75, r=25, t=55, b=70),
 
 
 
398
  xaxis=dict(tickangle=-30),
399
  )
400
+ return apply_dark_plot_layout(fig)
401
 
402
 
403
  def production_plot():
 
412
  textposition="top center",
413
  line=dict(color="#14b8a6", width=3),
414
  marker=dict(size=12),
415
+ textfont=dict(color="#f8fafc"),
416
  hovertemplate="V4-Flash SLA %{x} tok/s/user<br>Throughput uplift %{y}%<extra></extra>",
417
  )
418
  )
 
426
  textposition="top center",
427
  line=dict(color="#f97316", width=3),
428
  marker=dict(size=12),
429
+ textfont=dict(color="#f8fafc"),
430
  hovertemplate="V4-Pro SLA %{x} tok/s/user<br>Throughput uplift %{y}%<extra></extra>",
431
  )
432
  )
 
436
  yaxis_title="Aggregate throughput uplift vs MTP-1",
437
  height=380,
438
  margin=dict(l=45, r=25, t=55, b=45),
 
 
 
439
  yaxis=dict(gridcolor="rgba(148,163,184,0.18)"),
440
  legend=dict(orientation="h", yanchor="bottom", y=1.02, xanchor="left", x=0),
441
  )
442
+ return apply_dark_plot_layout(fig)
443
 
444
 
445
  def inventory_plot():
 
466
  xaxis_title="Target model family",
467
  height=380,
468
  margin=dict(l=45, r=25, t=55, b=45),
 
 
 
469
  yaxis=dict(gridcolor="rgba(148,163,184,0.18)"),
470
  legend=dict(orientation="h", yanchor="bottom", y=1.02, xanchor="left", x=0),
471
  )
472
+ return apply_dark_plot_layout(fig)
473
 
474
 
475
  def architecture_panel():
 
624
  --panel: rgba(15, 23, 42, 0.86);
625
  --line: rgba(148, 163, 184, 0.18);
626
  --text: #e5efff;
627
+ --muted: #b8c4d6;
628
  }
629
  .gradio-container {
630
+ color-scheme: dark;
631
+ --body-background-fill: #070b13;
632
+ --body-text-color: #e5efff;
633
+ --block-background-fill: rgba(15, 23, 42, 0.92);
634
+ --block-border-color: rgba(148, 163, 184, 0.24);
635
+ --border-color-primary: rgba(148, 163, 184, 0.28);
636
+ --input-background-fill: #0b1220;
637
+ --input-border-color: rgba(148, 163, 184, 0.36);
638
+ --input-placeholder-color: #94a3b8;
639
+ --button-primary-background-fill: #0f766e;
640
+ --button-primary-background-fill-hover: #0d9488;
641
+ --button-primary-text-color: #f8fafc;
642
+ --link-text-color: #67e8f9;
643
  background:
644
  radial-gradient(circle at 12% 0%, rgba(20, 184, 166, 0.18), transparent 28%),
645
  linear-gradient(135deg, #070b13 0%, #0f172a 52%, #111827 100%);
646
  color: var(--text);
647
  }
648
+ .gradio-container label,
649
+ .gradio-container .label,
650
+ .gradio-container .prose,
651
+ .gradio-container .prose * {
652
+ color: #dbeafe !important;
653
+ }
654
+ .gradio-container input,
655
+ .gradio-container textarea,
656
+ .gradio-container select {
657
+ background: #0b1220 !important;
658
+ color: #f8fafc !important;
659
+ border-color: rgba(148, 163, 184, 0.36) !important;
660
+ }
661
+ .gradio-container input::placeholder,
662
+ .gradio-container textarea::placeholder {
663
+ color: #94a3b8 !important;
664
+ }
665
+ .gradio-container input:focus,
666
+ .gradio-container textarea:focus,
667
+ .gradio-container select:focus {
668
+ border-color: rgba(20, 184, 166, 0.76) !important;
669
+ box-shadow: 0 0 0 2px rgba(20, 184, 166, 0.18) !important;
670
+ }
671
+ .gradio-container button {
672
+ border-color: rgba(148, 163, 184, 0.28) !important;
673
+ }
674
+ .gradio-container button[role="tab"],
675
+ .gradio-container .tab-nav button {
676
+ background: #0b1220 !important;
677
+ color: #cbd5e1 !important;
678
+ border-color: rgba(148, 163, 184, 0.2) !important;
679
+ }
680
+ .gradio-container button[aria-selected="true"],
681
+ .gradio-container button[role="tab"][aria-selected="true"] {
682
+ background: rgba(20, 184, 166, 0.18) !important;
683
+ color: #f8fafc !important;
684
+ border-color: rgba(20, 184, 166, 0.48) !important;
685
+ }
686
+ .gradio-container .wrap,
687
+ .gradio-container .block,
688
+ .gradio-container .panel,
689
+ .gradio-container .form {
690
+ background: rgba(15, 23, 42, 0.72) !important;
691
+ border-color: rgba(148, 163, 184, 0.22) !important;
692
+ color: #e5efff !important;
693
+ }
694
+ .gradio-container .dataframe,
695
+ .gradio-container .table-wrap,
696
+ .gradio-container table {
697
+ background: #0b1220 !important;
698
+ color: #e5efff !important;
699
+ border-color: rgba(148, 163, 184, 0.24) !important;
700
+ }
701
+ .gradio-container th {
702
+ background: #111827 !important;
703
+ color: #f8fafc !important;
704
+ border-color: rgba(148, 163, 184, 0.24) !important;
705
+ }
706
+ .gradio-container td {
707
+ background: #0b1220 !important;
708
+ color: #e2e8f0 !important;
709
+ border-color: rgba(148, 163, 184, 0.18) !important;
710
+ }
711
+ .gradio-container tr:nth-child(even) td {
712
+ background: #0f172a !important;
713
+ }
714
+ .gradio-container .plot-container,
715
+ .gradio-container .js-plotly-plot {
716
+ background: #0b1220 !important;
717
+ border-radius: 8px;
718
+ }
719
  .main-shell {
720
  border: 1px solid var(--line);
721
  border-radius: 8px;
 
773
  border-radius: 8px;
774
  padding: 14px;
775
  min-height: 118px;
776
+ background: rgba(2, 6, 23, 0.66);
777
  position: relative;
778
  overflow: hidden;
779
  }