Spaces:
Runtime error
Runtime error
model type
Browse files
app.py
CHANGED
|
@@ -21,10 +21,12 @@ def get_recent_models(min_likes, days_ago):
|
|
| 21 |
# Ensure created_at is offset-naive
|
| 22 |
created_at_date = model.created_at.replace(tzinfo=None)
|
| 23 |
if created_at_date >= start_date and model.likes >= min_likes:
|
|
|
|
| 24 |
recent_models.append({
|
| 25 |
"Model ID": f'<a href="https://huggingface.co/{model.modelId}" target="_blank">{model.modelId}</a>',
|
| 26 |
"Likes": model.likes,
|
| 27 |
-
"Creation Date": model.created_at.strftime("%Y-%m-%d %H:%M")
|
|
|
|
| 28 |
})
|
| 29 |
else:
|
| 30 |
# Since the models are sorted by likes in descending order,
|
|
@@ -38,8 +40,9 @@ def get_recent_models(min_likes, days_ago):
|
|
| 38 |
|
| 39 |
# Define the Gradio interface
|
| 40 |
with gr.Blocks() as demo:
|
| 41 |
-
gr.Markdown("#
|
| 42 |
-
gr.Markdown("
|
|
|
|
| 43 |
with gr.Row():
|
| 44 |
likes_slider = gr.Slider(minimum=0, maximum=100, step=10, value=10, label="Minimum Likes")
|
| 45 |
days_slider = gr.Slider(minimum=1, maximum=7, step=1, value=1, label="Days Ago")
|
|
@@ -48,9 +51,10 @@ with gr.Blocks() as demo:
|
|
| 48 |
|
| 49 |
with gr.Column():
|
| 50 |
df = gr.DataFrame(
|
| 51 |
-
headers=["Model ID", "Likes", "Creation Date"],
|
| 52 |
wrap=True,
|
| 53 |
-
datatype=["html", "number", "str"],
|
|
|
|
| 54 |
)
|
| 55 |
|
| 56 |
btn.click(fn=get_recent_models, inputs=[likes_slider, days_slider], outputs=df)
|
|
|
|
| 21 |
# Ensure created_at is offset-naive
|
| 22 |
created_at_date = model.created_at.replace(tzinfo=None)
|
| 23 |
if created_at_date >= start_date and model.likes >= min_likes:
|
| 24 |
+
task = model.pipeline_tag if hasattr(model, "pipeline_tag") else "N/A"
|
| 25 |
recent_models.append({
|
| 26 |
"Model ID": f'<a href="https://huggingface.co/{model.modelId}" target="_blank">{model.modelId}</a>',
|
| 27 |
"Likes": model.likes,
|
| 28 |
+
"Creation Date": model.created_at.strftime("%Y-%m-%d %H:%M"),
|
| 29 |
+
"Task": task
|
| 30 |
})
|
| 31 |
else:
|
| 32 |
# Since the models are sorted by likes in descending order,
|
|
|
|
| 40 |
|
| 41 |
# Define the Gradio interface
|
| 42 |
with gr.Blocks() as demo:
|
| 43 |
+
gr.Markdown("# Recently Created Models on Hugging Face")
|
| 44 |
+
gr.Markdown("Filter recent models from the Hugging Face Hub based on minimum likes and the number of days ago they were created.")
|
| 45 |
+
|
| 46 |
with gr.Row():
|
| 47 |
likes_slider = gr.Slider(minimum=0, maximum=100, step=10, value=10, label="Minimum Likes")
|
| 48 |
days_slider = gr.Slider(minimum=1, maximum=7, step=1, value=1, label="Days Ago")
|
|
|
|
| 51 |
|
| 52 |
with gr.Column():
|
| 53 |
df = gr.DataFrame(
|
| 54 |
+
headers=["Model ID", "Likes", "Creation Date", "Task"],
|
| 55 |
wrap=True,
|
| 56 |
+
datatype=["html", "number", "str", "str"],
|
| 57 |
+
interactive=True
|
| 58 |
)
|
| 59 |
|
| 60 |
btn.click(fn=get_recent_models, inputs=[likes_slider, days_slider], outputs=df)
|