Upload with huggingface_hub
Browse files- README.md +6 -7
- requirements.txt +1 -0
- run.py +35 -0
README.md
CHANGED
@@ -1,12 +1,11 @@
|
|
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: gradio
|
7 |
sdk_version: 3.6
|
8 |
-
app_file:
|
9 |
pinned: false
|
10 |
---
|
11 |
-
|
12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
+
|
2 |
---
|
3 |
+
title: blocks_multiple_event_triggers_main
|
4 |
+
emoji: π₯
|
5 |
+
colorFrom: indigo
|
6 |
+
colorTo: indigo
|
7 |
sdk: gradio
|
8 |
sdk_version: 3.6
|
9 |
+
app_file: run.py
|
10 |
pinned: false
|
11 |
---
|
|
|
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
https://gradio-main-build.s3.amazonaws.com/c3bec6153737855510542e8154391f328ac72606/gradio-3.6-py3-none-any.whl
|
run.py
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import pypistats
|
3 |
+
from datetime import date
|
4 |
+
from dateutil.relativedelta import relativedelta
|
5 |
+
import pandas as pd
|
6 |
+
|
7 |
+
pd.options.plotting.backend = "plotly"
|
8 |
+
|
9 |
+
|
10 |
+
def get_plot(lib, time):
|
11 |
+
data = pypistats.overall(lib, total=True, format="pandas")
|
12 |
+
data = data.groupby("category").get_group("with_mirrors").sort_values("date")
|
13 |
+
start_date = date.today() - relativedelta(months=int(time.split(" ")[0]))
|
14 |
+
data = data[(data['date'] > str(start_date))]
|
15 |
+
chart = data.plot(x="date", y="downloads")
|
16 |
+
return chart
|
17 |
+
|
18 |
+
|
19 |
+
with gr.Blocks() as demo:
|
20 |
+
gr.Markdown(
|
21 |
+
"""
|
22 |
+
## Pypi Download Stats π
|
23 |
+
See live download stats for all of Hugging Face's open-source libraries π€
|
24 |
+
""")
|
25 |
+
with gr.Row():
|
26 |
+
lib = gr.Dropdown(["transformers", "datasets", "huggingface-hub", "gradio", "accelerate"], label="Library")
|
27 |
+
time = gr.Dropdown(["3 months", "6 months", "9 months", "12 months"], label="Downloads over the last...")
|
28 |
+
|
29 |
+
plt = gr.Plot()
|
30 |
+
# You can add multiple event triggers in 2 lines like this
|
31 |
+
for event in [lib.change, time.change]:
|
32 |
+
event(get_plot, [lib, time], [plt])
|
33 |
+
|
34 |
+
if __name__ == "__main__":
|
35 |
+
demo.launch()
|