Spaces:
No application file
No application file
File size: 6,664 Bytes
46074e2 fe37569 46074e2 0fe9c4b fe37569 0fe9c4b a842e7b 0fe9c4b a842e7b 44cdfaa ca1c22f fe37569 46074e2 fe37569 e7593e4 fe37569 e7593e4 fe37569 07f1a08 fe37569 07f1a08 fe37569 07f1a08 ecdee91 fe37569 46074e2 a842e7b fe37569 a842e7b 0fe9c4b a842e7b fe37569 a842e7b fe37569 a842e7b fe37569 a842e7b fe37569 ecdee91 a842e7b fe37569 a842e7b fe37569 07f1a08 fe37569 a842e7b 07f1a08 fe37569 a842e7b 07f1a08 a842e7b fe37569 a842e7b 07f1a08 a842e7b fe37569 07f1a08 fe37569 07f1a08 fe37569 a842e7b fe37569 a842e7b fe37569 a842e7b 07f1a08 a842e7b fe37569 a842e7b ecdee91 a842e7b ecdee91 a842e7b ecdee91 a842e7b |
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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
#!/usr/bin/env python3
"""
Agent2Robot - MCP Hackathon 2024 Submission
AI-Powered Vehicle Design Assistant with MCP Integration
"""
import os
import ssl
import json
# Minimal SSL fix for local development (won't affect HuggingFace Spaces)
try:
# Only apply SSL fix if needed
ssl._create_default_https_context = ssl._create_unverified_context
except:
pass
import gradio as gr
from design_tools import VehicleDesigner
# Initialize the vehicle designer with MCP integration
designer = VehicleDesigner()
def design_vehicle_interface(vehicle_type, description):
"""
Interface function for Gradio that uses MCP-integrated design tools
"""
try:
# Use the MCP-integrated designer with simulation
report, json_output, simulation_info = designer.design_vehicle_with_simulation(vehicle_type, description)
return report, json_output, simulation_info
except Exception as e:
error_msg = f"Error in design process: {str(e)}"
return error_msg, "{\"error\": \"Design process failed\"}", "Simulation failed"
def get_mcp_status():
"""Get MCP server status for display"""
status = designer.get_mcp_status()
return f"MCP Server: {status['name']} v{status['version']} - Status: {status['status']}"
# Create Gradio interface
def create_app():
with gr.Blocks(
title="π€π Agent2Robot - MCP Hackathon 2024",
theme=gr.themes.Soft()
) as app:
# Header
gr.HTML("""
<div style="text-align: center; padding: 20px; background: linear-gradient(90deg, #667eea 0%, #764ba2 100%); color: white; border-radius: 10px; margin-bottom: 20px;">
<h1>π€π Agent2Robot Design Assistant</h1>
<p>AI-Powered Vehicle Design with MCP Integration</p>
<p><strong>MCP Hackathon 2024 Submission</strong></p>
</div>
""")
# MCP Status Display
with gr.Row():
gr.Markdown("### π MCP Server Status")
mcp_status = gr.Textbox(
value=get_mcp_status(),
label="Server Connection",
interactive=False
)
with gr.Row():
# Input Section
with gr.Column(scale=1):
gr.Markdown("## π― Design Parameters")
vehicle_type = gr.Dropdown(
choices=["Robot", "Drone", "Autonomous Vehicle", "Robotic Arm"],
label="π Vehicle Type",
value="Robot"
)
description = gr.Textbox(
label="π Design Requirements",
lines=6,
placeholder="Describe your vehicle requirements and specifications...\n\nExample: Design a warehouse robot for navigation and package delivery with 50kg payload capacity, 8-hour operation time, and obstacle avoidance.",
value="Design a robot for warehouse navigation and package delivery"
)
generate_btn = gr.Button("π Generate Design with MCP", variant="primary", size="lg")
# Output Section
with gr.Column(scale=2):
gr.Markdown("## π MCP Design Results")
design_report = gr.Textbox(
label="π― Complete Design Report",
lines=25,
interactive=False,
show_copy_button=True
)
design_json = gr.Textbox(
label="π Technical Specifications (JSON)",
lines=12,
interactive=False,
show_copy_button=True
)
# Simulation Video Section
with gr.Row():
with gr.Column():
gr.Markdown("## π¬ MCP Simulation Video")
simulation_output = gr.Textbox(
label="π₯ Simulation Generated via MCP Server",
lines=15,
interactive=False,
show_copy_button=True,
placeholder="Simulation video information will appear here after design generation..."
)
# Connect functionality
generate_btn.click(
fn=design_vehicle_interface,
inputs=[vehicle_type, description],
outputs=[design_report, design_json, simulation_output]
)
# Additional MCP Info Section
with gr.Row():
with gr.Column():
gr.Markdown("""
### π§ MCP Integration Features
**Model Context Protocol (MCP) Integration:**
- **π Server Communication**: Direct integration with MCP servers for design generation
- **π Real-time Validation**: Live design validation through MCP protocols
- **π― Context Awareness**: Maintains design context across sessions
- **π¬ Simulation Generation**: MCP-powered video simulation creation
- **π Scalable Architecture**: Modular design supporting multiple MCP servers
""")
with gr.Column():
gr.Markdown("""
### π MCP Hackathon 2024 - Technical Stack
**Core Components:**
- **MCP Client**: `mcp_client.py` - Handles server communication
- **Design Tools**: `design_tools.py` - Core vehicle design logic
- **Gradio Interface**: `app.py` - User interaction layer
- **Simulation Engine**: MCP-integrated video generation
- **Modular Architecture**: Clean separation of concerns
""")
# Footer
gr.Markdown("""
---
### π Agent2Robot - MCP Hackathon 2024
**AI-Powered Vehicle Design Assistant** with **Model Context Protocol Integration**
Create optimized designs for robots, drones, autonomous vehicles, and robotic arms using advanced AI algorithms and MCP server communication.
**MCP Features**: Server integration β’ Real-time validation β’ Context preservation β’ Simulation generation β’ Modular architecture
Built with β€οΈ for the MCP Hackathon 2024 | Powered by Gradio + MCP
""")
return app
# Launch the application
if __name__ == "__main__":
app = create_app()
app.launch() |