emsesc commited on
Commit
c0fb006
·
1 Parent(s): 9e3c83b

change to alert

Browse files
Files changed (1) hide show
  1. app.py +92 -70
app.py CHANGED
@@ -3,11 +3,7 @@ import pandas as pd
3
  import dash_mantine_components as dmc
4
  import duckdb
5
  import time
6
- from graphs.leaderboard import (
7
- button_style,
8
- get_top_n_leaderboard,
9
- render_table_content
10
- )
11
  from dash_iconify import DashIconify
12
 
13
  # Initialize the app
@@ -282,7 +278,42 @@ app.layout = dmc.MantineProvider(
282
  className="responsive-header", # <-- add class
283
  ),
284
  html.Div(
285
- [
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
286
  html.Span(
287
  "The Open Model Leaderboard",
288
  style={
@@ -293,58 +324,10 @@ app.layout = dmc.MantineProvider(
293
  "marginBottom": "20px",
294
  },
295
  ),
296
- # Add info popover next to the title
297
- dmc.Popover(
298
- width=350,
299
- position="top",
300
- withArrow=True,
301
- shadow="md",
302
- offset=8,
303
- children=[
304
- dmc.PopoverTarget(
305
- html.Span(
306
- DashIconify(
307
- icon="mdi:information-outline",
308
- width=22,
309
- height=22,
310
- style={
311
- "marginLeft": "12px",
312
- "color": "#AC482A",
313
- "verticalAlign": "middle",
314
- "cursor": "pointer",
315
- },
316
- ),
317
- style={"display": "inline-block"},
318
- )
319
- ),
320
- dmc.PopoverDropdown(
321
- html.Div(
322
- [
323
- html.Span("Note: This dashboard uses ", style={"color": "#082030", "fontWeight": "500"}),
324
- html.A(
325
- "public Hugging Face download data",
326
- href="https://huggingface.co/datasets/hfmlsoc/hub_weekly_snapshots",
327
- target="_blank",
328
- style={
329
- "color": "#AC482A",
330
- "fontWeight": "bold",
331
- "textDecoration": "underline"
332
- },
333
- ),
334
- html.Span(", which is less precise than data analyzed in the paper.", style={"color": "#082030", "fontWeight": "500"}),
335
- ],
336
- style={
337
- "fontSize": "15px",
338
- "lineHeight": "1.5",
339
- "margin": "4px 0",
340
- },
341
- )
342
- ),
343
- ],
344
- ),
345
  ],
346
  style={
347
  "display": "flex",
 
348
  "alignItems": "center",
349
  "justifyContent": "center",
350
  "gap": "12px",
@@ -427,8 +410,16 @@ app.layout = dmc.MantineProvider(
427
  color="#AC482A",
428
  transitionDuration=200,
429
  data=[
430
- {"value": "all-downloads", "label": "All Downloads"},
431
- {"value": "filtered-downloads", "label": html.Span(["Filtered Downloads"])},
 
 
 
 
 
 
 
 
432
  ],
433
  mb=10,
434
  ),
@@ -451,8 +442,14 @@ app.layout = dmc.MantineProvider(
451
  color="#AC482A",
452
  transitionDuration=200,
453
  data=[
454
- {"value": "uploader", "label": "Model Uploader"},
455
- {"value": "original_creator", "label": "Original Model Creator"},
 
 
 
 
 
 
456
  ],
457
  mb=10,
458
  ),
@@ -571,9 +568,14 @@ app.layout = dmc.MantineProvider(
571
  html.Div(
572
  children=[
573
  "The country leaderboard shows how downloads are distributed across different nations, highlighting which countries are leading in model usage and adoption. The metadata includes the ",
574
- html.Span("country", className="meta-var"),
 
 
575
  " and number of ",
576
- html.Span("user downloads", className="meta-var"),
 
 
 
577
  ".",
578
  ],
579
  className="tab-description",
@@ -583,7 +585,9 @@ app.layout = dmc.MantineProvider(
583
  id="loading-countries",
584
  type="circle",
585
  color="#AC482A",
586
- children=html.Div(id="top_countries-table"),
 
 
587
  ),
588
  className="responsive-table-wrapper", # <-- add wrapper for scroll
589
  ),
@@ -616,11 +620,18 @@ app.layout = dmc.MantineProvider(
616
  html.Div(
617
  children=[
618
  "The developer leaderboard highlights the most influential model creators on Hugging Face, showcasing which developers have garnered the highest download counts for their models. The metadata includes the ",
619
- html.Span("developer", className="meta-var"),
 
 
620
  ", number of ",
621
- html.Span("user downloads", className="meta-var"),
 
 
 
622
  ", and ",
623
- html.Span("country", className="meta-var"),
 
 
624
  ".",
625
  ],
626
  className="tab-description",
@@ -665,13 +676,22 @@ app.layout = dmc.MantineProvider(
665
  html.Div(
666
  children=[
667
  "The model leaderboard ranks individual models based on their download counts, revealing which models are most popular among users on Hugging Face. The metadata includes the ",
668
- html.Span("model name", className="meta-var"),
 
 
669
  ", number of ",
670
- html.Span("user downloads", className="meta-var"),
 
 
 
671
  ", ",
672
- html.Span("developer", className="meta-var"),
 
 
673
  ", and ",
674
- html.Span("modality", className="meta-var"),
 
 
675
  " (the input and output types of the model).",
676
  ],
677
  className="tab-description",
@@ -681,7 +701,9 @@ app.layout = dmc.MantineProvider(
681
  id="loading-models",
682
  type="circle",
683
  color="#AC482A",
684
- children=html.Div(id="top_models-table"),
 
 
685
  ),
686
  className="responsive-table-wrapper",
687
  ),
 
3
  import dash_mantine_components as dmc
4
  import duckdb
5
  import time
6
+ from graphs.leaderboard import button_style, get_top_n_leaderboard, render_table_content
 
 
 
 
7
  from dash_iconify import DashIconify
8
 
9
  # Initialize the app
 
278
  className="responsive-header", # <-- add class
279
  ),
280
  html.Div(
281
+ children=[
282
+ dmc.Alert(
283
+ # add an icon to the alert
284
+ icon=DashIconify(
285
+ icon="mdi:information-outline",
286
+ width=18,
287
+ height=18,
288
+ style={"color": "#1A5F8D"},
289
+ ),
290
+ children=[
291
+ "Note: This dashboard uses ",
292
+ html.A(
293
+ "public Hugging Face",
294
+ href="https://huggingface.co/datasets/hfmlsoc/hub_weekly_snapshots",
295
+ target="_blank",
296
+ style={
297
+ "color": "#1A5F8D",
298
+ "fontWeight": "bold",
299
+ "textDecoration": "underline",
300
+ },
301
+ ),
302
+ " download data, which is less precise than data analyzed in the paper.",
303
+ ],
304
+ color="blue",
305
+ radius="md",
306
+ variant="light",
307
+ withCloseButton=True,
308
+ style={
309
+ "marginTop": "16px",
310
+ "marginBottom": "8px",
311
+ "fontSize": "15px",
312
+ "fontWeight": "500",
313
+ "marginLeft": "auto",
314
+ "marginRight": "auto",
315
+ },
316
+ ),
317
  html.Span(
318
  "The Open Model Leaderboard",
319
  style={
 
324
  "marginBottom": "20px",
325
  },
326
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
327
  ],
328
  style={
329
  "display": "flex",
330
+ "flexDirection": "column",
331
  "alignItems": "center",
332
  "justifyContent": "center",
333
  "gap": "12px",
 
410
  color="#AC482A",
411
  transitionDuration=200,
412
  data=[
413
+ {
414
+ "value": "all-downloads",
415
+ "label": "All Downloads",
416
+ },
417
+ {
418
+ "value": "filtered-downloads",
419
+ "label": html.Span(
420
+ ["Filtered Downloads"]
421
+ ),
422
+ },
423
  ],
424
  mb=10,
425
  ),
 
442
  color="#AC482A",
443
  transitionDuration=200,
444
  data=[
445
+ {
446
+ "value": "uploader",
447
+ "label": "Model Uploader",
448
+ },
449
+ {
450
+ "value": "original_creator",
451
+ "label": "Original Model Creator",
452
+ },
453
  ],
454
  mb=10,
455
  ),
 
568
  html.Div(
569
  children=[
570
  "The country leaderboard shows how downloads are distributed across different nations, highlighting which countries are leading in model usage and adoption. The metadata includes the ",
571
+ html.Span(
572
+ "country", className="meta-var"
573
+ ),
574
  " and number of ",
575
+ html.Span(
576
+ "user downloads",
577
+ className="meta-var",
578
+ ),
579
  ".",
580
  ],
581
  className="tab-description",
 
585
  id="loading-countries",
586
  type="circle",
587
  color="#AC482A",
588
+ children=html.Div(
589
+ id="top_countries-table"
590
+ ),
591
  ),
592
  className="responsive-table-wrapper", # <-- add wrapper for scroll
593
  ),
 
620
  html.Div(
621
  children=[
622
  "The developer leaderboard highlights the most influential model creators on Hugging Face, showcasing which developers have garnered the highest download counts for their models. The metadata includes the ",
623
+ html.Span(
624
+ "developer", className="meta-var"
625
+ ),
626
  ", number of ",
627
+ html.Span(
628
+ "user downloads",
629
+ className="meta-var",
630
+ ),
631
  ", and ",
632
+ html.Span(
633
+ "country", className="meta-var"
634
+ ),
635
  ".",
636
  ],
637
  className="tab-description",
 
676
  html.Div(
677
  children=[
678
  "The model leaderboard ranks individual models based on their download counts, revealing which models are most popular among users on Hugging Face. The metadata includes the ",
679
+ html.Span(
680
+ "model name", className="meta-var"
681
+ ),
682
  ", number of ",
683
+ html.Span(
684
+ "user downloads",
685
+ className="meta-var",
686
+ ),
687
  ", ",
688
+ html.Span(
689
+ "developer", className="meta-var"
690
+ ),
691
  ", and ",
692
+ html.Span(
693
+ "modality", className="meta-var"
694
+ ),
695
  " (the input and output types of the model).",
696
  ],
697
  className="tab-description",
 
701
  id="loading-models",
702
  type="circle",
703
  color="#AC482A",
704
+ children=html.Div(
705
+ id="top_models-table"
706
+ ),
707
  ),
708
  className="responsive-table-wrapper",
709
  ),