Spaces:
Runtime error
Runtime error
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, | |
) | |
async def root(): | |
return {"message": "UNIK ML API"} | |
app.include_router(stable_diffusion.router, prefix=settings.prefix, tags=["inference"]) | |