Spaces:
Sleeping
Sleeping
Claude Code Claude Opus 4.6 commited on
Commit ·
aeb2cae
1
Parent(s): 03e9f81
Fix runtime error: replace .launch() with uvicorn.run() for FastAPI
Browse filesThe app was calling .launch() on a FastAPI object which doesn't have
that method. For sdk:docker with FastAPI, use uvicorn.run() instead.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
app.py
CHANGED
|
@@ -795,10 +795,10 @@ def create_agent_office_with_ws():
|
|
| 795 |
|
| 796 |
# ========== Main Entry Point ==========
|
| 797 |
|
| 798 |
-
|
| 799 |
-
|
| 800 |
-
app = create_agent_office_with_ws()
|
| 801 |
|
|
|
|
| 802 |
# Get environment variables with fallbacks
|
| 803 |
server_name = os.getenv("GRADIO_SERVER_NAME", "0.0.0.0")
|
| 804 |
server_port = int(os.getenv("PORT", "7860"))
|
|
@@ -809,8 +809,6 @@ if __name__ == "__main__":
|
|
| 809 |
print(f"[Agent Office] Base directory: {BASE_DIR}")
|
| 810 |
print(f"[Agent Office] WebSocket API enabled at /api/thoughts")
|
| 811 |
|
| 812 |
-
app.launch(
|
| 813 |
-
|
| 814 |
-
|
| 815 |
-
share=False
|
| 816 |
-
)
|
|
|
|
| 795 |
|
| 796 |
# ========== Main Entry Point ==========
|
| 797 |
|
| 798 |
+
# Create the app for uvicorn (sdk:docker)
|
| 799 |
+
app = create_agent_office_with_ws()
|
|
|
|
| 800 |
|
| 801 |
+
if __name__ == "__main__":
|
| 802 |
# Get environment variables with fallbacks
|
| 803 |
server_name = os.getenv("GRADIO_SERVER_NAME", "0.0.0.0")
|
| 804 |
server_port = int(os.getenv("PORT", "7860"))
|
|
|
|
| 809 |
print(f"[Agent Office] Base directory: {BASE_DIR}")
|
| 810 |
print(f"[Agent Office] WebSocket API enabled at /api/thoughts")
|
| 811 |
|
| 812 |
+
# Use uvicorn to serve the FastAPI app (not .launch())
|
| 813 |
+
import uvicorn
|
| 814 |
+
uvicorn.run(app, host=server_name, port=server_port)
|
|
|
|
|
|