Spaces:
Sleeping
Sleeping
Download app.py from vishalharkal/BookMind: direct link, hf CLI and curl.
- Browser
- Download file 1.3 kB
-
https://huggingface.co/spaces/vishalharkal/BookMind/resolve/main/app.py
- Command line
-
hf download hf://spaces/vishalharkal/BookMind/app.py
-
curl -L -o app.py https://huggingface.co/spaces/vishalharkal/BookMind/resolve/main/app.py
1.3 kB
| #!/usr/bin/env python | |
| """ | |
| BookMind - AI-Powered Book Recommendation System | |
| FastAPI entry point for Hugging Face Spaces deployment | |
| """ | |
| from fastapi import FastAPI | |
| from fastapi.staticfiles import StaticFiles | |
| from fastapi.responses import JSONResponse | |
| from pathlib import Path | |
| import uvicorn | |
| # Create FastAPI app | |
| app = FastAPI( | |
| title="BookMind", | |
| description="AI-Powered Book Recommendation System", | |
| version="1.0.0" | |
| ) | |
| # Try to mount frontend static files if they exist | |
| frontend_dist = Path("frontend/dist") | |
| if frontend_dist.exists(): | |
| app.mount("/", StaticFiles(directory=str(frontend_dist), html=True), name="static") | |
| async def health_check(): | |
| """Health check endpoint for HF Spaces""" | |
| return {"status": "healthy", "app": "BookMind"} | |
| async def api_health(): | |
| """API health check endpoint""" | |
| return {"status": "ok", "service": "BookMind API"} | |
| async def root(): | |
| """Root endpoint - returns app info""" | |
| return { | |
| "app": "BookMind", | |
| "status": "running", | |
| "version": "1.0.0", | |
| "description": "AI-Powered Book Recommendation System" | |
| } | |
| if __name__ == "__main__": | |
| uvicorn.run( | |
| "app:app", | |
| host="0.0.0.0", | |
| port=7860, | |
| reload=False | |
| ) | |