mcp-model-info / app.py
3morixd's picture
Upload app.py with huggingface_hub
c408d08 verified
Raw
History Blame Contribute Delete
1.53 kB
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)