Spaces:
Running
Running
SIN-Deploy-Bot commited on
Commit ·
af17b2a
1
Parent(s): 28bd726
fix: rename app.py to main.py to avoid package import conflict
Browse files- uvicorn now uses main:app instead of app:app
- Prevents Python from importing the 'app' package instead of app.py
- app.py → main.py +8 -2
- start.sh +1 -1
app.py → main.py
RENAMED
|
@@ -244,8 +244,9 @@ app.mount("/", gradio_app.app)
|
|
| 244 |
app.post("/a2a/v1")(handle_a2a_message)
|
| 245 |
|
| 246 |
|
| 247 |
-
# Health check
|
| 248 |
@app.get("/health")
|
|
|
|
| 249 |
async def health() -> JSONResponse:
|
| 250 |
agent = _ensure_agent()
|
| 251 |
return JSONResponse(
|
|
@@ -256,6 +257,11 @@ async def health() -> JSONResponse:
|
|
| 256 |
}
|
| 257 |
)
|
| 258 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 259 |
|
| 260 |
# Agent card endpoint
|
| 261 |
@app.get("/.well-known/agent-card.json")
|
|
@@ -286,5 +292,5 @@ async def oauth_client() -> JSONResponse:
|
|
| 286 |
|
| 287 |
if __name__ == "__main__":
|
| 288 |
import uvicorn
|
| 289 |
-
|
| 290 |
uvicorn.run(app, host="0.0.0.0", port=int(os.getenv("PORT", 7860)))
|
|
|
|
| 244 |
app.post("/a2a/v1")(handle_a2a_message)
|
| 245 |
|
| 246 |
|
| 247 |
+
# Health check (HF expects 200 on /)
|
| 248 |
@app.get("/health")
|
| 249 |
+
@app.get("/healthz")
|
| 250 |
async def health() -> JSONResponse:
|
| 251 |
agent = _ensure_agent()
|
| 252 |
return JSONResponse(
|
|
|
|
| 257 |
}
|
| 258 |
)
|
| 259 |
|
| 260 |
+
# Root endpoint for HF space page
|
| 261 |
+
@app.get("/")
|
| 262 |
+
async def root() -> JSONResponse:
|
| 263 |
+
return JSONResponse({"service": "A2A Cloud Coder", "status": "running"})
|
| 264 |
+
|
| 265 |
|
| 266 |
# Agent card endpoint
|
| 267 |
@app.get("/.well-known/agent-card.json")
|
|
|
|
| 292 |
|
| 293 |
if __name__ == "__main__":
|
| 294 |
import uvicorn
|
| 295 |
+
print("🚀 Starting uvicorn on port", int(os.getenv("PORT", 7860)))
|
| 296 |
uvicorn.run(app, host="0.0.0.0", port=int(os.getenv("PORT", 7860)))
|
start.sh
CHANGED
|
@@ -77,4 +77,4 @@ fi
|
|
| 77 |
|
| 78 |
# Start the application with uvicorn directly
|
| 79 |
echo "🎯 Starting uvicorn on port ${PORT:-7860}"
|
| 80 |
-
exec python -m uvicorn
|
|
|
|
| 77 |
|
| 78 |
# Start the application with uvicorn directly
|
| 79 |
echo "🎯 Starting uvicorn on port ${PORT:-7860}"
|
| 80 |
+
exec python -m uvicorn main:app --host 0.0.0.0 --port ${PORT:-7860} --log-level info
|