Spaces:
Runtime error
Runtime error
Upload app.py with huggingface_hub
Browse files
app.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import pandas as pd
|
| 3 |
+
import json
|
| 4 |
+
|
| 5 |
+
with open("models.json") as f:
|
| 6 |
+
MODELS = json.load(f)
|
| 7 |
+
|
| 8 |
+
df = pd.DataFrame(MODELS)
|
| 9 |
+
|
| 10 |
+
def filter_models(family: str, min_speed: float, max_size: int):
|
| 11 |
+
filtered = df.copy()
|
| 12 |
+
if family != "All":
|
| 13 |
+
filtered = filtered[filtered["name"].str.contains(family, case=False)]
|
| 14 |
+
if min_speed > 0:
|
| 15 |
+
filtered = filtered[filtered["cpu_tps"] >= min_speed]
|
| 16 |
+
if max_size < 99999:
|
| 17 |
+
filtered = filtered[filtered["size_mb"] <= max_size]
|
| 18 |
+
return filtered.sort_values("cpu_tps", ascending=False)
|
| 19 |
+
|
| 20 |
+
with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue"), title="Model Browser") as demo:
|
| 21 |
+
gr.Markdown("# 🗂️ dispatchAI Model Browser")
|
| 22 |
+
gr.Markdown(f"Browse all {len(MODELS)} verified working models.")
|
| 23 |
+
|
| 24 |
+
with gr.Row():
|
| 25 |
+
family = gr.Dropdown(["All", "SmolLM", "Llama", "Qwen", "Gemma", "Phi", "TinyLlama", "MiniCPM"], value="All", label="Family")
|
| 26 |
+
min_speed = gr.Slider(0, 60, value=0, step=1, label="Min Speed (t/s)")
|
| 27 |
+
max_size = gr.Slider(100, 10000, value=10000, step=100, label="Max Size (MB)")
|
| 28 |
+
|
| 29 |
+
table = gr.Dataframe(df.sort_values("cpu_tps", ascending=False))
|
| 30 |
+
|
| 31 |
+
for inp in [family, min_speed, max_size]:
|
| 32 |
+
inp.change(fn=filter_models, inputs=[family, min_speed, max_size], outputs=table)
|
| 33 |
+
|
| 34 |
+
gr.Markdown("---\n🚀 [dispatchAI](https://huggingface.co/dispatchAI)")
|
| 35 |
+
demo.launch()
|