Spaces:
Running
Running
hf health check
Browse files- py_backend/app/main.py +15 -0
py_backend/app/main.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
| 3 |
from app.routers import upload, caption, metadata, models
|
| 4 |
from app.config import settings
|
| 5 |
from app.routers.images import router as images_router
|
|
@@ -27,6 +28,20 @@ app.include_router(models.router, prefix="/api", tags=["models"])
|
|
| 27 |
app.include_router(upload.router, prefix="/api/images", tags=["images"])
|
| 28 |
app.include_router(images_router, prefix="/api/contribute", tags=["contribute"])
|
| 29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
print("π PromptAid Vision API server ready")
|
| 31 |
print("π Available endpoints: /api/images, /api/captions, /api/metadata, /api/models")
|
| 32 |
print(f"π Environment: {settings.ENVIRONMENT}")
|
|
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
from fastapi.middleware.cors import CORSMiddleware
|
| 3 |
+
from fastapi.responses import HTMLResponse, JSONResponse
|
| 4 |
from app.routers import upload, caption, metadata, models
|
| 5 |
from app.config import settings
|
| 6 |
from app.routers.images import router as images_router
|
|
|
|
| 28 |
app.include_router(upload.router, prefix="/api/images", tags=["images"])
|
| 29 |
app.include_router(images_router, prefix="/api/contribute", tags=["contribute"])
|
| 30 |
|
| 31 |
+
@app.get("/", include_in_schema=False, response_class=HTMLResponse)
|
| 32 |
+
async def root():
|
| 33 |
+
# simple page so HF health-check gets 200 OK
|
| 34 |
+
return """<!doctype html>
|
| 35 |
+
<title>PromptAid Vision</title>
|
| 36 |
+
<h1>PromptAid Vision API</h1>
|
| 37 |
+
<p>OK</p>
|
| 38 |
+
<p>See <a href="/docs">/docs</a> for the API.</p>
|
| 39 |
+
"""
|
| 40 |
+
|
| 41 |
+
@app.get("/health", include_in_schema=False, response_class=JSONResponse)
|
| 42 |
+
async def health():
|
| 43 |
+
return {"status": "ok"}
|
| 44 |
+
|
| 45 |
print("π PromptAid Vision API server ready")
|
| 46 |
print("π Available endpoints: /api/images, /api/captions, /api/metadata, /api/models")
|
| 47 |
print(f"π Environment: {settings.ENVIRONMENT}")
|