File size: 932 Bytes
0536019
fb3f880
dcb122f
6bae932
fb3f880
6bae932
 
461ace0
6bae932
fb3f880
6bae932
 
 
 
 
 
 
fb3f880
dcb122f
 
 
 
 
 
 
 
fb3f880
84f2663
 
 
 
 
291b6bb
0536019
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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)
#