| from fastapi import FastAPI | |
| from fastapi.middleware.cors import CORSMiddleware | |
| from face_swap.api import router | |
| app = FastAPI() | |
| # Add CORS middleware | |
| origins = [ | |
| "http://localhost:3000", # React frontend | |
| ] | |
| app.add_middleware( | |
| CORSMiddleware, | |
| allow_origins=origins, | |
| allow_credentials=True, | |
| allow_methods=["*"], | |
| allow_headers=["*"], | |
| ) | |
| app.include_router(router) | |
| if __name__ == "__main__": | |
| import uvicorn | |
| uvicorn.run(app, host="0.0.0.0", port=8000) | |