Spaces:
Runtime error
Runtime error
Download app.py from thisisgini/ecommerce_bot: direct link, hf CLI and curl.
- Browser
- Download file 741 Bytes
-
https://huggingface.co/spaces/thisisgini/ecommerce_bot/resolve/main/app.py
- Command line
-
hf download hf://spaces/thisisgini/ecommerce_bot/app.py
-
curl -L -o app.py https://huggingface.co/spaces/thisisgini/ecommerce_bot/resolve/main/app.py
741 Bytes
| from fastapi import FastAPI, Request | |
| from inference import run_inference # Importing from your root inference.py | |
| import uvicorn | |
| app = FastAPI() | |
| # Health Check Endpoint | |
| async def health_check(): | |
| return {"status": "healthy", "message": "Ecommerce Bot API is live"} | |
| # Prediction Endpoint | |
| async def predict(request: Request): | |
| data = await request.json() | |
| # Assuming your inference.py has a function called run_inference | |
| result = run_inference(data) | |
| return {"prediction": result} | |
| # The Reset Endpoint (which your logs show is already working) | |
| async def reset(): | |
| return {"status": "ok"} | |
| if __name__ == "__main__": | |
| uvicorn.run(app, host="0.0.0.0", port=7860) |