Spaces:
Runtime error
Runtime error
Download src/main.py from HAK-16/physai-backend: direct link, hf CLI and curl.
- Browser
- Download file 934 Bytes
-
https://huggingface.co/spaces/HAK-16/physai-backend/resolve/main/src/main.py
- Command line
-
hf download hf://spaces/HAK-16/physai-backend/src/main.py
-
curl -L -o main.py https://huggingface.co/spaces/HAK-16/physai-backend/resolve/main/src/main.py
934 Bytes
| import logging | |
| from fastapi import FastAPI | |
| from fastapi.middleware.cors import CORSMiddleware | |
| from src.api.chat import chat_router # Import chat_router | |
| logging.basicConfig(level=logging.INFO) | |
| logger = logging.getLogger(__name__) | |
| app = FastAPI() | |
| origins = [ | |
| "http://localhost:3000", | |
| "http://localhost:3001", | |
| "https://physical-ai-and-humanoid-robotics-h.vercel.app", | |
| "https://frontend-coq6lfeib-huzairs-projects-272a3e04.vercel.app", | |
| ] | |
| app.add_middleware( | |
| CORSMiddleware, | |
| allow_origins=origins, | |
| allow_credentials=True, | |
| allow_methods=["*"], | |
| allow_headers=["*"], | |
| ) | |
| app.include_router(chat_router, prefix="/api") # Include chat_router with prefix | |
| async def read_root(): | |
| logger.info("GET / endpoint accessed") | |
| return {"status": "Physical AI API Ready"} | |
| async def health_check(): | |
| logger.info("GET /health endpoint accessed") | |
| return {"status": "OK"} |