Spaces:
Sleeping
Sleeping
| from fastapi import FastAPI | |
| from routes import predictions | |
| from fastapi.middleware.cors import CORSMiddleware | |
| app = FastAPI() | |
| origins = [ | |
| "http://127.0.0.1:5173", # Add Vite default port | |
| "http://localhost:5173", | |
| "http://127.0.0.1:5501", | |
| "http://localhost:5501", | |
| "http://127.0.0.1:5500", | |
| "http://localhost:5500", | |
| "https://agro-vision-frontend.vercel.app" | |
| ] | |
| app.add_middleware( | |
| CORSMiddleware, | |
| allow_origins=origins, # Allows specific origins | |
| allow_credentials=True, | |
| allow_methods=["*"], # Allows all methods (GET, POST, etc.) | |
| allow_headers=["*"], # Allows all headers | |
| ) | |
| app.include_router(predictions.router) |