dots-ocr-idcard / main.py
tommulder's picture
feat(api): fast FastAPI app + model loader refactor; add mock mode for tests\n\n- Add pyproject + setuptools config and console entrypoint\n- Implement enhanced field extraction + MRZ heuristics\n- Add response builder with compatibility for legacy MRZ fields\n- New preprocessing pipeline for PDFs/images\n- HF Spaces GPU: cache ENV, optional flash-attn, configurable base image\n- Add Make targets for Spaces GPU and local CPU\n- Add httpx for TestClient; tests pass in mock mode\n- Remove embedded model files and legacy app/modules
211e423
raw
history blame
750 Bytes
#!/usr/bin/env python3
"""Main entry point for the KYB Tech Dots.OCR application.
Provides a callable ``main()`` for console_scripts and direct execution.
"""
import os
import uvicorn
from src.kybtech_dots_ocr.app import app
def main() -> None:
"""Start the FastAPI server with sensible defaults.
This function is exposed as a console script via pyproject.toml.
Set DOTS_OCR_SKIP_MODEL_LOAD=1 to skip heavy model download for local testing.
"""
# Respect environment overrides for host/port
host = os.getenv("HOST", "0.0.0.0")
port = int(os.getenv("PORT", "7860"))
log_level = os.getenv("LOG_LEVEL", "info")
uvicorn.run(app, host=host, port=port, log_level=log_level)
if __name__ == "__main__":
main()