Azazelle commited on
Commit
f59f6b1
ยท
verified ยท
1 Parent(s): 5042e07

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -16
app.py CHANGED
@@ -75,24 +75,26 @@ def get_recent_models(min_likes, days_ago, filter_string, search_string):
75
  return df
76
 
77
  # Define the Gradio interface
78
- def launch_interface():
79
- iface = gr.Interface(
80
- fn=get_recent_models,
81
- inputs=[
82
- gr.Slider(minimum=1, maximum=100, step=1, value=5, label="Minimum Likes"),
83
- gr.Slider(minimum=1, maximum=30, step=1, value=3, label="Days Ago"),
84
- gr.Text(label="Filter", max_lines=1),
85
- gr.Text(label="Search", max_lines=1)
86
- ],
87
- outputs=gr.DataFrame(
 
 
 
 
88
  headers=["Model ID", "Likes", "Creation Date", "Task"],
89
  wrap=True,
90
  datatype=["html", "number", "str"],
91
- ),
92
- title="Model Drops Tracker ๐Ÿš€",
93
- description="Overwhelmed by the rapid pace of model releases? ๐Ÿ˜… You're not alone! That's exactly why I built this tool. Easily filter recent models from the Hub by setting a minimum number of likes and the number of days since their release. Click on a model to see its card. Use `;` to split filter and search"
94
- )
95
- iface.launch()
96
 
97
  if __name__ == "__main__":
98
- launch_interface()
 
75
  return df
76
 
77
  # Define the Gradio interface
78
+ with gr.Blocks() as demo:
79
+ gr.Markdown("# Model Drops Tracker ๐Ÿš€")
80
+ gr.Markdown("Overwhelmed by the rapid pace of model releases? ๐Ÿ˜… You're not alone! That's exactly why I built this tool. Easily filter recent models from the Hub by setting a minimum number of likes and the number of days since their release. Click on a model to see its card. Use `;` to split filter and search")
81
+ with gr.Row():
82
+ likes_slider = gr.Slider(minimum=1, maximum=100, step=1, value=5, label="Minimum Likes")
83
+ days_slider = gr.Slider(minimum=1, maximum=30, step=1, value=3, label="Days Ago")
84
+ with gr.Row():
85
+ filter_text = gr.Text(label="Filter", max_lines=1)
86
+ search_text = gr.Text(label="Search", max_lines=1)
87
+
88
+ btn = gr.Button("Run")
89
+
90
+ with gr.Column():
91
+ df = gr.DataFrame(
92
  headers=["Model ID", "Likes", "Creation Date", "Task"],
93
  wrap=True,
94
  datatype=["html", "number", "str"],
95
+ )
96
+
97
+ btn.click(fn=get_recent_models, inputs=[likes_slider, days_slider, filter_text, search_text], outputs=df)
 
 
98
 
99
  if __name__ == "__main__":
100
+ demo.launch()