Spaces:
Runtime error
Runtime error
added origin for cors
Browse files- backend/main.py +6 -1
backend/main.py
CHANGED
|
@@ -5,10 +5,15 @@ from fastapi.middleware.cors import CORSMiddleware
|
|
| 5 |
|
| 6 |
app = FastAPI(title="Gen AI Email Processing API") # This creates the FastAPI app instance
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
#router = APIRouter()
|
| 9 |
app.add_middleware(
|
| 10 |
CORSMiddleware,
|
| 11 |
-
allow_origins=
|
| 12 |
allow_credentials=True,
|
| 13 |
allow_methods=["*"],
|
| 14 |
allow_headers=["*"],
|
|
|
|
| 5 |
|
| 6 |
app = FastAPI(title="Gen AI Email Processing API") # This creates the FastAPI app instance
|
| 7 |
|
| 8 |
+
origins = [
|
| 9 |
+
"http://localhost:4200", # Angular frontend (Local)
|
| 10 |
+
"https://vivek0912-genaiemailclassification.hf.space", # Hugging Face frontend
|
| 11 |
+
]
|
| 12 |
+
|
| 13 |
#router = APIRouter()
|
| 14 |
app.add_middleware(
|
| 15 |
CORSMiddleware,
|
| 16 |
+
allow_origins=origins, # Replace "*" with your frontend domain in production
|
| 17 |
allow_credentials=True,
|
| 18 |
allow_methods=["*"],
|
| 19 |
allow_headers=["*"],
|