import uvicorn from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from huggingface_hub import login from config import settings from routers.intference import stable_diffusion login(settings.hf_token) app = FastAPI( title="UNIK ML", version=settings.version, openapi_url=f"{settings.prefix}/openapi.json", docs_url=f"{settings.prefix}/docs", redoc_url=f"{settings.prefix}/redoc", swagger_ui_oauth2_redirect_url=f"{settings.prefix}/docs/oauth2-redirect") app.add_middleware( CORSMiddleware, allow_origins=["*"], allow_methods=["*"], allow_headers=["*"], allow_credentials=True, ) @app.get("/") async def root(): return {"message": "UNIK ML API"} app.include_router(stable_diffusion.router, prefix=settings.prefix, tags=["inference"]) # Start your FastAPI application # if __name__ == "__main__": # uvicorn.run(app, host="0.0.0.0", port=8000) #