LysandreJik commited on
Commit
fd2274b
0 Parent(s):

Initial commit

Browse files
Files changed (2) hide show
  1. README.md +12 -0
  2. app.py +32 -0
README.md ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Transformers Checkpoints
3
+ emoji: 🦀
4
+ colorFrom: blue
5
+ colorTo: yellow
6
+ sdk: gradio
7
+ sdk_version: 3.4
8
+ app_file: app.py
9
+ pinned: false
10
+ ---
11
+
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio
2
+ import gradio as gr
3
+ import plotly.graph_objects as go
4
+ from datasets import load_dataset
5
+ from huggingface_hub import list_datasets
6
+
7
+ pipelines = [d.id[20:-21] for d in list_datasets(author='open-source-metrics') if 'checkpoint-downloads' in d.id]
8
+
9
+
10
+ def plot(library: str, stacked: bool):
11
+ dataset = load_dataset(f"open-source-metrics/{library}-checkpoint-downloads")['train']
12
+
13
+ dates = dataset['dates']
14
+ axis = dataset.column_names
15
+ axis.remove('dates')
16
+
17
+ fig = go.Figure()
18
+ for i in axis:
19
+ fig.add_trace(
20
+ go.Scatter(x=dates, y=dataset[i], mode='lines+markers', name=i, stackgroup='one' if stacked else None)
21
+ )
22
+
23
+ fig.show()
24
+ return fig
25
+
26
+
27
+ demo = gr.Interface(fn=plot, inputs=[
28
+ gr.Dropdown(pipelines),
29
+ gr.Checkbox(label='Stacked')
30
+ ], outputs=gr.Plot())
31
+
32
+ demo.launch()