polyglot-ocr-jp / main.py
xqt's picture
asdasd
e9aee4a
raw
history blame contribute delete
498 Bytes
import asyncio
from fastapi import FastAPI
from api.endpoints import router
from services.worker import preprocessor_worker, ocr_worker, janitor_worker
from core.config import settings
import os
app = FastAPI(title=settings.PROJECT_NAME)
app.include_router(router)
@app.on_event("startup")
async def startup_event():
os.makedirs(settings.STORAGE_DIR, exist_ok=True)
asyncio.create_task(preprocessor_worker())
asyncio.create_task(ocr_worker())
asyncio.create_task(janitor_worker())