Spaces:
Sleeping
Sleeping
Commit
·
84f637a
1
Parent(s):
9ce75f7
- app.py +49 -53
- hugging_face_spaces.csv +0 -0
app.py
CHANGED
@@ -124,20 +124,27 @@ def get_most_liked_users():
|
|
124 |
return y.iloc[:7].astype(str), fig
|
125 |
|
126 |
|
127 |
-
def
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
startangle=90
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
|
|
|
|
138 |
return fig
|
139 |
|
140 |
|
|
|
|
|
|
|
|
|
|
|
141 |
def get_sdk_frequencies():
|
142 |
fig = plt.figure()
|
143 |
sns.stripplot(x='sdk', y='likes', data=spaces, jitter=True)
|
@@ -146,54 +153,43 @@ def get_sdk_frequencies():
|
|
146 |
|
147 |
|
148 |
def get_io_proportions():
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
return
|
|
|
|
|
|
|
164 |
|
165 |
|
166 |
def get_packages_proportions():
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
# explode=(0.15, 0, 0),
|
176 |
-
startangle=90,
|
177 |
-
autopct='%1.1f%%')
|
178 |
-
|
179 |
-
plt.axis('equal')
|
180 |
-
plt.tight_layout()
|
181 |
-
return fig
|
182 |
|
183 |
|
184 |
def get_processable_spaces_proportions():
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
# explode=(0.15, 0, 0),
|
191 |
-
startangle=90,
|
192 |
-
autopct='%1.1f%%')
|
193 |
-
|
194 |
-
plt.axis('equal')
|
195 |
-
plt.tight_layout()
|
196 |
-
return fig
|
197 |
|
198 |
|
199 |
def get_tsne():
|
|
|
124 |
return y.iloc[:7].astype(str), fig
|
125 |
|
126 |
|
127 |
+
def pie_plot(data, figsize=(10, 5)):
|
128 |
+
colors = ['#ff9999', '#66b3ff', '#99ff99', '#ffcc99']
|
129 |
+
|
130 |
+
fig = plt.figure(figsize=figsize)
|
131 |
+
for i, (categories, counts) in enumerate(data.items()):
|
132 |
+
plt.subplot(1, len(data), i+1)
|
133 |
+
plt.pie(list(map(int, counts.split(","))), colors=colors, labels=categories.split(","), autopct='%1.1f%%', startangle=90)
|
134 |
+
# draw circle
|
135 |
+
centre_circle = plt.Circle((0, 0), 0.70, fc='white')
|
136 |
+
plt.gcf().gca().add_artist(centre_circle)
|
137 |
+
# Equal aspect ratio ensures that pie is drawn as a circle
|
138 |
+
plt.axis('equal')
|
139 |
+
plt.tight_layout()
|
140 |
return fig
|
141 |
|
142 |
|
143 |
+
def get_sdk_proportions():
|
144 |
+
df = spaces.groupby('sdk').size().reset_index(name='counts')
|
145 |
+
return pie_plot({",".join(list(df['sdk'])): ",".join(df['counts'].astype(str))})
|
146 |
+
|
147 |
+
|
148 |
def get_sdk_frequencies():
|
149 |
fig = plt.figure()
|
150 |
sns.stripplot(x='sdk', y='likes', data=spaces, jitter=True)
|
|
|
153 |
|
154 |
|
155 |
def get_io_proportions():
|
156 |
+
inputs = [y.split(',') for y in spaces[spaces['inputs'].notnull()]['inputs'].values]
|
157 |
+
inputs = [x for xs in inputs for x in xs]
|
158 |
+
inputs = pd.Series(inputs).value_counts()
|
159 |
+
mask = (inputs/inputs.sum() * 100).lt(2)
|
160 |
+
updated_inputs = inputs[~mask]
|
161 |
+
updated_inputs['Other'] = inputs[mask].sum()
|
162 |
+
|
163 |
+
outputs = [y.split(',') for y in spaces[spaces['outputs'].notnull()]['outputs'].values]
|
164 |
+
outputs = [x for xs in outputs for x in xs]
|
165 |
+
outputs = pd.Series(outputs).value_counts()
|
166 |
+
mask = (outputs/outputs.sum() * 100).lt(2)
|
167 |
+
updated_outputs = outputs[~mask]
|
168 |
+
updated_outputs['Other'] = outputs[mask].sum()
|
169 |
+
|
170 |
+
return pie_plot({
|
171 |
+
",".join(list(updated_inputs.index.astype(str))): ",".join(updated_inputs.values.astype(str)),
|
172 |
+
",".join(list(updated_outputs.index.astype(str))): ",".join(updated_outputs.values.astype(str))
|
173 |
+
})
|
174 |
|
175 |
|
176 |
def get_packages_proportions():
|
177 |
+
spaces_ai_reqs = [y.split(',') for y in spaces[spaces['ai_ml_reqs'].notnull()]['ai_ml_reqs'].values]
|
178 |
+
spaces_ai_reqs = [x for xs in spaces_ai_reqs for x in xs]
|
179 |
+
spaces_ai_reqs = pd.Series(spaces_ai_reqs).value_counts()
|
180 |
+
mask = (spaces_ai_reqs/spaces_ai_reqs.sum() * 100).lt(3)
|
181 |
+
updated_spaces_ai_reqs = spaces_ai_reqs[~mask]
|
182 |
+
updated_spaces_ai_reqs['Other'] = spaces_ai_reqs[mask].sum()
|
183 |
+
print(updated_spaces_ai_reqs)
|
184 |
+
return pie_plot({",".join(list(updated_spaces_ai_reqs.index.astype(str))): ",".join(updated_spaces_ai_reqs.values.astype(str))})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
185 |
|
186 |
|
187 |
def get_processable_spaces_proportions():
|
188 |
+
spaces_status = spaces['status'].value_counts()
|
189 |
+
mask = (spaces_status/spaces_status.sum() * 100).lt(5)
|
190 |
+
updated_spaces_status = spaces_status[~mask]
|
191 |
+
updated_spaces_status['Error'] = spaces_status[mask].sum()
|
192 |
+
return pie_plot({",".join(list(updated_spaces_status.index.astype(str))): ",".join(updated_spaces_status.values.astype(str))})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
|
194 |
|
195 |
def get_tsne():
|
hugging_face_spaces.csv
CHANGED
The diff for this file is too large to render.
See raw diff
|
|