Update app.py
Browse files
app.py
CHANGED
|
@@ -442,27 +442,9 @@ if __name__ == "__main__":
|
|
| 442 |
print("Please set either OPENAI_API_KEY or ANTHROPIC_API_KEY in your .env file")
|
| 443 |
print(f"Example: echo 'OPENAI_API_KEY=your_key_here' > .env")
|
| 444 |
|
| 445 |
-
#
|
| 446 |
-
|
| 447 |
-
|
| 448 |
-
|
| 449 |
-
|
| 450 |
-
|
| 451 |
-
|
| 452 |
-
# Add redirect from root to Gradio UI
|
| 453 |
-
@fastapi_app.get("/")
|
| 454 |
-
async def root():
|
| 455 |
-
return RedirectResponse(url="/ui")
|
| 456 |
-
|
| 457 |
-
# Create Gradio ASGI app and mount at /ui
|
| 458 |
-
gradio_app = gr.routes.App.create_app(app)
|
| 459 |
-
fastapi_app.mount("/ui", gradio_app)
|
| 460 |
-
|
| 461 |
-
print("β
MCP Generator starting...")
|
| 462 |
-
print("π Gradio UI: http://0.0.0.0:7860/ui")
|
| 463 |
-
print("π Root (/) redirects to /ui")
|
| 464 |
-
print("π§ MCP List: http://0.0.0.0:7860/mcps")
|
| 465 |
-
print("π Generated MCPs: /{mcp_id}/mcp")
|
| 466 |
-
|
| 467 |
-
# Run with uvicorn
|
| 468 |
-
uvicorn.run(fastapi_app, host="0.0.0.0", port=7860)
|
|
|
|
| 442 |
print("Please set either OPENAI_API_KEY or ANTHROPIC_API_KEY in your .env file")
|
| 443 |
print(f"Example: echo 'OPENAI_API_KEY=your_key_here' > .env")
|
| 444 |
|
| 445 |
+
# Launch Gradio UI
|
| 446 |
+
app.launch(
|
| 447 |
+
server_name="0.0.0.0",
|
| 448 |
+
server_port=7860,
|
| 449 |
+
share=False
|
| 450 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|