Spaces:
Runtime error
Runtime error
Dan Vancea commited on
Commit ·
fc1cec8
1
Parent(s): e812ba5
Fixed typo
Browse files
api.py
CHANGED
|
@@ -15,10 +15,10 @@ logging.basicConfig(level=logging.INFO)
|
|
| 15 |
logger = logging.getLogger("API")
|
| 16 |
|
| 17 |
# FastAPI application entry point
|
| 18 |
-
|
| 19 |
|
| 20 |
# CORS configuration to allow frontend communication
|
| 21 |
-
|
| 22 |
CORSMiddleware,
|
| 23 |
allow_origins=["*"],
|
| 24 |
allow_credentials=True,
|
|
@@ -139,7 +139,7 @@ def predict(
|
|
| 139 |
return prediction, runtime
|
| 140 |
|
| 141 |
# Image upscaling endpoint
|
| 142 |
-
@
|
| 143 |
async def upscale(
|
| 144 |
file: UploadFile = File(...),
|
| 145 |
model_name: str = Form(...),
|
|
@@ -215,4 +215,4 @@ async def upscale(
|
|
| 215 |
|
| 216 |
# Development entry point
|
| 217 |
if __name__ == "__main__":
|
| 218 |
-
uvicorn.run(
|
|
|
|
| 15 |
logger = logging.getLogger("API")
|
| 16 |
|
| 17 |
# FastAPI application entry point
|
| 18 |
+
api = FastAPI(title="EnhanceAI")
|
| 19 |
|
| 20 |
# CORS configuration to allow frontend communication
|
| 21 |
+
api.add_middleware(
|
| 22 |
CORSMiddleware,
|
| 23 |
allow_origins=["*"],
|
| 24 |
allow_credentials=True,
|
|
|
|
| 139 |
return prediction, runtime
|
| 140 |
|
| 141 |
# Image upscaling endpoint
|
| 142 |
+
@api.post("/upscale")
|
| 143 |
async def upscale(
|
| 144 |
file: UploadFile = File(...),
|
| 145 |
model_name: str = Form(...),
|
|
|
|
| 215 |
|
| 216 |
# Development entry point
|
| 217 |
if __name__ == "__main__":
|
| 218 |
+
uvicorn.run(api, host="0.0.0.0", port=8000)
|