Spaces:
Running
Running
| from fastapi import FastAPI | |
| from fastapi.middleware.cors import CORSMiddleware | |
| from .routes import generate_image, enhance_prompt, auth | |
| app = FastAPI() | |
| # Configure CORS | |
| app.add_middleware( | |
| CORSMiddleware, | |
| allow_origins=["*"], # Adjust this in production | |
| allow_credentials=True, | |
| allow_methods=["*"], | |
| allow_headers=["*"], | |
| ) | |
| # Include routers | |
| app.include_router(generate_image.router, prefix="/api") | |
| app.include_router(enhance_prompt.router, prefix="/api") | |
| app.include_router(auth.router, prefix="/api") | |
| async def root(): | |
| return {"message": "Welcome to the Imagine API"} | |