Create and share ML model demos with interactive UI.
## Gradio MCP Server: Interactive ML Demos and APIs The **Gradio MCP Server** integrates Gradio's rapid prototyping capabilities into Google Antigravity. This framework enables developers to create interactive web interfaces for machine learning models with just a few lines of Python code. ### Why Gradio MCP? Gradio accelerates ML application development: - **Rapid Prototyping**: Build UIs in minutes, not hours - **Automatic APIs**: Every interface includes a REST API - **Hugging Face Integration**: One-click deployment to Spaces - **Component Library**: Rich set of input/output components - **Antigravity Native**: AI-assisted interface creation ### Key Features #### 1. Simple Interface Creation ```python import gradio as gr def predict_sentiment(text): # Your ML model logic return {"positive": 0.85, "negative": 0.15} demo = gr.Interface( fn=predict_sentiment, inputs=gr.Textbox(placeholder="Enter text to analyze..."), outputs=gr.Label(num_top_classes=2), title="Sentiment Analyzer", examples=["I love this product!", "This is terrible."] ) demo.launch() ``` #### 2. Complex Multi-Component Apps ```python with gr.Blocks() as demo: gr.Markdown("# Image Classification App") with gr.Row(): with gr.Column(): image_input = gr.Image(type="pil") submit_btn = gr.Button("Classify") with gr.Column(): label_output = gr.Label() confidence = gr.Number(label="Confidence") submit_btn.click( fn=classify_image, inputs=image_input, outputs=[label_output, confidence] ) ``` #### 3. API Endpoints ```python # Automatic API generation demo.launch() # Creates: /api/predict endpoint # Custom API documentation demo.launch(show_api=True) # Programmatic access from gradio_client import Client client = Client("your-username/your-app") result = client.predict("input text", api_name="/predict") ``` ### Configuration ```json { "mcpServers": { "gradio": { "command": "npx", "args": ["-y", "@anthropic/mcp-gradio"], "env": { "GRADIO_SERVER_NAME": "0.0.0.0", "GRADIO_SERVER_PORT": "7860", "HF_TOKEN": "your-huggingface-token" } } } } ``` ### Use Cases **Model Demos**: Share interactive demos of your ML models with stakeholders without any frontend development. **Internal Tools**: Build quick internal tools for data annotation, model testing, or data exploration. **Prototype APIs**: Rapidly prototype and test API designs before committing to full implementation. The Gradio MCP Server empowers Antigravity users to build and deploy ML interfaces in record time.
{
"mcpServers": {
"gradio": {}
}
}