Download main.py from ZeloTech/zelotech: direct link, hf CLI and curl.
- Browser
- Download file 882 Bytes
-
https://huggingface.co/spaces/ZeloTech/zelotech/resolve/main/main.py
- Command line
-
hf download hf://spaces/ZeloTech/zelotech/main.py
-
curl -L -o main.py https://huggingface.co/spaces/ZeloTech/zelotech/resolve/main/main.py
882 Bytes
| from contextlib import asynccontextmanager | |
| from fastapi import FastAPI | |
| from api import routes_audio, routes_text | |
| from config import get_settings | |
| from infra.factory import build_extractor, build_transcriber | |
| async def lifespan(app: FastAPI): | |
| # Carrega os modelos uma unica vez, no boot. Se algo estiver errado | |
| # (modelo, device, dependencia), o servico falha cedo, nao na 1a requisicao. | |
| settings = get_settings() | |
| app.state.transcriber = build_transcriber(settings) | |
| app.state.extractor = build_extractor(settings) | |
| yield | |
| # espaco para liberar recursos, se um dia for necessario | |
| app = FastAPI(title="Extracao & Transcricao", version="0.1.0", lifespan=lifespan) | |
| app.include_router(routes_text.router) | |
| app.include_router(routes_audio.router) | |
| def health(): | |
| return {"status": "ok"} | |