Spaces:
Runtime error
Runtime error
File size: 1,529 Bytes
c408d08 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | import gradio as gr
import json
with open("models.json") as f:
MODELS = json.load(f)
def get_model_info(model_name: str) -> str:
"""Get detailed info about a dispatchAI model.
Args:
model_name: Model name (e.g., "SmolLM2-135M-Instruct-mobile")
Returns:
JSON with model details
"""
for m in MODELS:
if m["name"].lower() == model_name.lower() or m["name"].lower() in model_name.lower():
return json.dumps(m, indent=2)
return json.dumps({"error": f"Model not found: {model_name}", "available": [m["name"] for m in MODELS]})
def list_verified_models() -> str:
"""List all verified working dispatchAI models."""
return json.dumps({"count": len(MODELS), "models": [m["name"] for m in MODELS]}, indent=2)
with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue"), title="Model Info") as demo:
gr.Markdown("# ๐ dispatchAI Model Info (MCP)")
with gr.Tab("Lookup"):
inp = gr.Textbox(label="Model Name", placeholder="SmolLM2-135M-Instruct-mobile")
btn = gr.Button("Get Info", variant="primary")
out = gr.Textbox(label="Info (JSON)", lines=15)
btn.click(fn=get_model_info, inputs=inp, outputs=out)
with gr.Tab("List All"):
list_btn = gr.Button("List All Models")
list_out = gr.Textbox(label="Models (JSON)", lines=10)
list_btn.click(fn=list_verified_models, outputs=list_out)
gr.Markdown("---\n๐ [dispatchAI](https://huggingface.co/dispatchAI)")
demo.launch(mcp_server=True)
|