Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -162,7 +162,18 @@ app = gr.Interface(
|
|
| 162 |
api_name="predict"
|
| 163 |
)
|
| 164 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 165 |
if __name__ == "__main__":
|
| 166 |
-
# Gradio
|
| 167 |
-
# (which uses RobotWatchPayload) to generate a valid MCP tool schema.
|
| 168 |
app.launch(mcp_server=True)
|
|
|
|
| 162 |
api_name="predict"
|
| 163 |
)
|
| 164 |
|
| 165 |
+
# ---------------------------------------------------
|
| 166 |
+
# Explicit MCP API Definition
|
| 167 |
+
# ---------------------------------------------------
|
| 168 |
+
# We explicitly add the API using the Pydantic model for schema generation
|
| 169 |
+
app.api.post(
|
| 170 |
+
"/mcp/tool/robot_watch", # This defines the exact endpoint path for the tool
|
| 171 |
+
run_vlm_analysis, # Link it to the Pydantic-typed function
|
| 172 |
+
inputs=[RobotWatchPayload], # Use the Pydantic model as the explicit input schema
|
| 173 |
+
outputs=[dict] # The output type
|
| 174 |
+
)
|
| 175 |
+
|
| 176 |
+
|
| 177 |
if __name__ == "__main__":
|
| 178 |
+
# Launch Gradio with mcp_server=True which hooks up the above API
|
|
|
|
| 179 |
app.launch(mcp_server=True)
|