Spaces:
Running
Running
burtenshaw
commited on
Commit
·
fd5c6de
1
Parent(s):
cc6a423
simplify percentile logic
Browse files
app.py
CHANGED
@@ -137,15 +137,15 @@ def create_image(stats, username):
|
|
137 |
# Add additional percentile info if other categories are significant
|
138 |
other_percentiles = []
|
139 |
if model_percentile > 0 and "model" not in avatar.lower():
|
140 |
-
other_percentiles.append(f"
|
141 |
if dataset_percentile > 0 and "dataset" not in avatar.lower():
|
142 |
-
other_percentiles.append(f"
|
143 |
if space_percentile > 0 and "space" not in avatar.lower():
|
144 |
-
other_percentiles.append(f"
|
145 |
|
146 |
if other_percentiles:
|
147 |
text_parts.append(
|
148 |
-
f'<span size="9pt">
|
149 |
)
|
150 |
|
151 |
# Join all parts with newlines
|
@@ -290,24 +290,23 @@ with gr.Blocks(title="Hugging Face Community Stats") as demo:
|
|
290 |
value="bartowski",
|
291 |
)
|
292 |
submit_btn = gr.Button("Get Stats", scale=6)
|
293 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
294 |
with gr.Row():
|
295 |
with gr.Column():
|
296 |
stats_image = gr.Markdown(f"![Hugging Face Stats]({DEFAULT_IMAGE})")
|
297 |
|
298 |
-
# Add example usernames
|
299 |
-
gr.Examples(
|
300 |
-
examples=[
|
301 |
-
["merve"],
|
302 |
-
["mlabonne"],
|
303 |
-
["bartowski"],
|
304 |
-
["huggingface"],
|
305 |
-
["cfahlgren1"],
|
306 |
-
],
|
307 |
-
inputs=username_input,
|
308 |
-
label="Try these examples",
|
309 |
-
)
|
310 |
-
|
311 |
def format_markdown(image_url):
|
312 |
return f"![Hugging Face Stats]({image_url})"
|
313 |
|
|
|
137 |
# Add additional percentile info if other categories are significant
|
138 |
other_percentiles = []
|
139 |
if model_percentile > 0 and "model" not in avatar.lower():
|
140 |
+
other_percentiles.append(f"Top {model_percentile}% in models")
|
141 |
if dataset_percentile > 0 and "dataset" not in avatar.lower():
|
142 |
+
other_percentiles.append(f"Top {dataset_percentile}% in datasets")
|
143 |
if space_percentile > 0 and "space" not in avatar.lower():
|
144 |
+
other_percentiles.append(f"Top {space_percentile}% in spaces")
|
145 |
|
146 |
if other_percentiles:
|
147 |
text_parts.append(
|
148 |
+
f'<span size="9pt">{". ".join(other_percentiles)}!</span>'
|
149 |
)
|
150 |
|
151 |
# Join all parts with newlines
|
|
|
290 |
value="bartowski",
|
291 |
)
|
292 |
submit_btn = gr.Button("Get Stats", scale=6)
|
293 |
+
with gr.Row():
|
294 |
+
# Add example usernames
|
295 |
+
gr.Examples(
|
296 |
+
examples=[
|
297 |
+
["merve"],
|
298 |
+
["mlabonne"],
|
299 |
+
["bartowski"],
|
300 |
+
["huggingface"],
|
301 |
+
["cfahlgren1"],
|
302 |
+
],
|
303 |
+
inputs=username_input,
|
304 |
+
label="Try these examples",
|
305 |
+
)
|
306 |
with gr.Row():
|
307 |
with gr.Column():
|
308 |
stats_image = gr.Markdown(f"![Hugging Face Stats]({DEFAULT_IMAGE})")
|
309 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
310 |
def format_markdown(image_url):
|
311 |
return f"![Hugging Face Stats]({image_url})"
|
312 |
|