-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.py
40 lines (31 loc) · 843 Bytes
/
server.py
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
40
import logging
import uvicorn
from fastapi import FastAPI, APIRouter
from rich.logging import RichHandler
FORMAT = "%(message)s"
logging.basicConfig(level=logging.INFO, format=FORMAT, datefmt="[%X]", handlers=[RichHandler()])
log = logging.getLogger("rich")
log.info("[red]APP started", extra={"markup": True})
desc = """
## components
- text to video generator
"""
from fastapi.middleware.cors import CORSMiddleware
app = FastAPI(
title="alekyaa",
description=desc,
version="1.0.0",
docs_url="/docs",
redoc_url="/redoc",
)
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
from main import endpoint_router
app.include_router(endpoint_router)
if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=8122)