Spaces:
Runtime error
Runtime error
Download backend/main.py from Vivek0912/GenAiEmailClassification: direct link, hf CLI and curl.
- Browser
- Download file 828 Bytes
-
https://huggingface.co/spaces/Vivek0912/GenAiEmailClassification/resolve/main/backend/main.py
- Command line
-
hf download hf://spaces/Vivek0912/GenAiEmailClassification/backend/main.py
-
curl -L -o main.py https://huggingface.co/spaces/Vivek0912/GenAiEmailClassification/resolve/main/backend/main.py
828 Bytes
| from fastapi import APIRouter, FastAPI | |
| from app.api.endpoints import router | |
| from fastapi.middleware.cors import CORSMiddleware | |
| app = FastAPI(title="Gen AI Email Processing API") # This creates the FastAPI app instance | |
| origins = [ | |
| "http://localhost:4200" # Angular frontend (Local) | |
| "https://vivek0912-genaiemailclassification.hf.space", # Hugging Face frontend | |
| ] | |
| #router = APIRouter() | |
| app.add_middleware( | |
| CORSMiddleware, | |
| allow_origins=["*"], # Replace "*" with your frontend domain in production | |
| allow_credentials=True, | |
| allow_methods=["*"], | |
| allow_headers=["*"], | |
| ) | |
| # Include API routes from endpoints.py | |
| app.include_router(router, prefix="/api") # You can remove prefix if not needed | |
| async def root(): | |
| return {"message": "Hello from FastAPI"} | |
| #app.include_router(router) | |