File size: 828 Bytes
fe6855c
 
 
 
 
 
 
2429523
8a50a39
66aef2b
2429523
 
fe6855c
 
 
102b81e
fe6855c
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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

@app.get("/")
async def root():
    return {"message": "Hello from FastAPI"}

#app.include_router(router)