feat: add OCR service container (refs #64)
Some checks failed
Deploy to Staging / Build Images (pull_request) Successful in 7m41s
Deploy to Staging / Deploy to Staging (pull_request) Failing after 13s
Deploy to Staging / Verify Staging (pull_request) Has been skipped
Deploy to Staging / Notify Staging Ready (pull_request) Has been skipped
Deploy to Staging / Notify Staging Failure (pull_request) Successful in 8s
Some checks failed
Deploy to Staging / Build Images (pull_request) Successful in 7m41s
Deploy to Staging / Deploy to Staging (pull_request) Failing after 13s
Deploy to Staging / Verify Staging (pull_request) Has been skipped
Deploy to Staging / Notify Staging Ready (pull_request) Has been skipped
Deploy to Staging / Notify Staging Failure (pull_request) Successful in 8s
Add Python-based OCR service container (mvp-ocr) as the 6th service: - Python 3.11-slim with FastAPI/uvicorn - Tesseract OCR with English language pack - pillow-heif for HEIC image support - opencv-python-headless for image preprocessing - Health endpoint at /health - Unit tests for health, HEIC support, and Tesseract availability Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
1
ocr/app/__init__.py
Normal file
1
ocr/app/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
# OCR Service Application
|
||||
15
ocr/app/config.py
Normal file
15
ocr/app/config.py
Normal file
@@ -0,0 +1,15 @@
|
||||
"""OCR Service Configuration."""
|
||||
import os
|
||||
|
||||
|
||||
class Settings:
|
||||
"""Application settings loaded from environment variables."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
self.log_level: str = os.getenv("LOG_LEVEL", "info")
|
||||
self.host: str = os.getenv("HOST", "0.0.0.0")
|
||||
self.port: int = int(os.getenv("PORT", "8000"))
|
||||
self.tesseract_cmd: str = os.getenv("TESSERACT_CMD", "/usr/bin/tesseract")
|
||||
|
||||
|
||||
settings = Settings()
|
||||
26
ocr/app/main.py
Normal file
26
ocr/app/main.py
Normal file
@@ -0,0 +1,26 @@
|
||||
"""OCR Service FastAPI Application."""
|
||||
from fastapi import FastAPI
|
||||
|
||||
from app.config import settings
|
||||
|
||||
app = FastAPI(
|
||||
title="MotoVaultPro OCR Service",
|
||||
description="OCR processing service for vehicle documents",
|
||||
version="1.0.0",
|
||||
)
|
||||
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check() -> dict:
|
||||
"""Health check endpoint for container orchestration."""
|
||||
return {"status": "healthy"}
|
||||
|
||||
|
||||
@app.get("/")
|
||||
async def root() -> dict:
|
||||
"""Root endpoint with service information."""
|
||||
return {
|
||||
"service": "mvp-ocr",
|
||||
"version": "1.0.0",
|
||||
"log_level": settings.log_level,
|
||||
}
|
||||
Reference in New Issue
Block a user