Spaces:
Sleeping
Sleeping
patrickvonplaten
commited on
Commit
•
5d18ec4
1
Parent(s):
d27cdb4
improve
Browse files
app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import os
|
2 |
from datetime import datetime
|
3 |
import json
|
|
|
4 |
from huggingface_hub import snapshot_download
|
5 |
from collections import defaultdict
|
6 |
import pandas as pd
|
@@ -8,21 +9,18 @@ import streamlit as st
|
|
8 |
from datetime import datetime, timedelta
|
9 |
import matplotlib.pyplot as plt
|
10 |
|
11 |
-
user_input = st.text_input("Enter your text here:")
|
12 |
-
|
13 |
libraries = [
|
14 |
-
"open-source-metrics/accelerate-dependents",
|
15 |
-
"open-source-metrics/hub-docs-dependents",
|
16 |
-
"open-source-metrics/huggingface_hub-dependents",
|
17 |
-
"open-source-metrics/evaluate-dependents",
|
18 |
-
"open-source-metrics/datasets-dependents",
|
19 |
-
"open-source-metrics/pytorch-image-models-dependents",
|
20 |
-
"open-source-metrics/tokenizers-dependents",
|
21 |
"open-source-metrics/transformers-dependents",
|
22 |
"open-source-metrics/diffusers-dependents",
|
|
|
|
|
23 |
"open-source-metrics/gradio-dependents",
|
24 |
-
"open-source-metrics/optimum-dependents",
|
25 |
"open-source-metrics/accelerate-dependents",
|
|
|
|
|
|
|
|
|
|
|
26 |
]
|
27 |
|
28 |
option = st.selectbox(
|
@@ -30,7 +28,7 @@ option = st.selectbox(
|
|
30 |
libraries
|
31 |
)
|
32 |
|
33 |
-
cached_folder = snapshot_download(
|
34 |
|
35 |
num_dependents = defaultdict(int)
|
36 |
num_stars_all_dependents = defaultdict(int)
|
@@ -131,12 +129,22 @@ num_cum_stars_df.set_index('Date', inplace=True)
|
|
131 |
num_cum_stars_df = num_cum_stars_df.resample('D').asfreq()
|
132 |
num_cum_stars_df['Value'] = num_cum_stars_df['Value'].interpolate()
|
133 |
|
|
|
|
|
134 |
# Plotting
|
135 |
plt.figure(figsize=(10, 6))
|
|
|
136 |
plt.plot(num_dependents_df.index, num_dependents_df['Value'], marker='o')
|
137 |
plt.xlabel('Date')
|
138 |
plt.ylabel('Number of Dependents')
|
139 |
plt.title('Dependencies History')
|
|
|
140 |
|
141 |
# Display in Streamlit
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
st.pyplot(plt)
|
|
|
1 |
import os
|
2 |
from datetime import datetime
|
3 |
import json
|
4 |
+
import matplotlib.ticker as ticker
|
5 |
from huggingface_hub import snapshot_download
|
6 |
from collections import defaultdict
|
7 |
import pandas as pd
|
|
|
9 |
from datetime import datetime, timedelta
|
10 |
import matplotlib.pyplot as plt
|
11 |
|
|
|
|
|
12 |
libraries = [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
"open-source-metrics/transformers-dependents",
|
14 |
"open-source-metrics/diffusers-dependents",
|
15 |
+
"open-source-metrics/pytorch-image-models-dependents",
|
16 |
+
"open-source-metrics/datasets-dependents",
|
17 |
"open-source-metrics/gradio-dependents",
|
|
|
18 |
"open-source-metrics/accelerate-dependents",
|
19 |
+
"open-source-metrics/evaluate-dependents",
|
20 |
+
"open-source-metrics/tokenizers-dependents",
|
21 |
+
"open-source-metrics/optimum-dependents",
|
22 |
+
"open-source-metrics/hub-docs-dependents",
|
23 |
+
"open-source-metrics/huggingface_hub-dependents",
|
24 |
]
|
25 |
|
26 |
option = st.selectbox(
|
|
|
28 |
libraries
|
29 |
)
|
30 |
|
31 |
+
cached_folder = snapshot_download(option, repo_type="dataset")
|
32 |
|
33 |
num_dependents = defaultdict(int)
|
34 |
num_stars_all_dependents = defaultdict(int)
|
|
|
129 |
num_cum_stars_df = num_cum_stars_df.resample('D').asfreq()
|
130 |
num_cum_stars_df['Value'] = num_cum_stars_df['Value'].interpolate()
|
131 |
|
132 |
+
filename = "_".join(option.split("/"))
|
133 |
+
|
134 |
# Plotting
|
135 |
plt.figure(figsize=(10, 6))
|
136 |
+
plt.gca().yaxis.set_major_formatter(ticker.StrMethodFormatter('{x:,.0f}'))
|
137 |
plt.plot(num_dependents_df.index, num_dependents_df['Value'], marker='o')
|
138 |
plt.xlabel('Date')
|
139 |
plt.ylabel('Number of Dependents')
|
140 |
plt.title('Dependencies History')
|
141 |
+
st.pyplot(plt)
|
142 |
|
143 |
# Display in Streamlit
|
144 |
+
plt.figure(figsize=(10, 6))
|
145 |
+
plt.gca().yaxis.set_major_formatter(ticker.StrMethodFormatter('{x:,.0f}'))
|
146 |
+
plt.plot(num_cum_stars_df.index, num_cum_stars_df['Value'], marker='o')
|
147 |
+
plt.xlabel('Date')
|
148 |
+
plt.ylabel('Cumulative number of stars of Dependents')
|
149 |
+
plt.title('Dependents Stars History')
|
150 |
st.pyplot(plt)
|
open-source-metrics_transformers-dependents_num.png
ADDED
open-source-metrics_transformers-dependents_stars.png
ADDED