psycological-bot / project /__init__.py
brestok's picture
Upload 29 files
c409a15 verified
raw
history blame contribute delete
714 Bytes
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from fastapi.staticfiles import StaticFiles
def create_app() -> FastAPI:
app = FastAPI()
from project.bot import bot_router
app.include_router(bot_router, tags=['bot'])
from project.ws import ws_router
app.include_router(ws_router, tags=['ws'])
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_methods=["*"],
allow_headers=["*"],
)
app.mount('/static', StaticFiles(directory="static"), name="static")
# @app.on_event("startup")
# async def on_startup():
# asyncio.create_task(initialize_dataset_from_directory())
#
return app