feat: add node-registry dashboard, matrix-presence-aggregator, ocr-service updates

This commit is contained in:
Apple
2025-11-28 05:23:14 -08:00
parent 04b1174641
commit 776ab3a7ba
15 changed files with 1162 additions and 56 deletions

View File

@@ -1,6 +1,6 @@
FROM python:3.11-slim
# Встановити системні залежності
# Встановити системні залежності для Tesseract
RUN apt-get update && apt-get install -y \
tesseract-ocr \
tesseract-ocr-ukr \
@@ -16,16 +16,16 @@ WORKDIR /app
# Копіювати requirements
COPY requirements.txt .
# Встановити Python залежності
# Встановити Python залежності (без EasyOCR для швидкого білду)
RUN pip install --no-cache-dir -r requirements.txt
# Завантажити EasyOCR моделі
RUN python -c "import easyocr; easyocr.Reader(['uk', 'en'], gpu=False)"
# Копіювати код
COPY app/ ./app/
EXPOSE 8896
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8896"]
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8896/health || exit 1
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8896"]

View File

@@ -92,11 +92,19 @@ async def root():
@app.get("/health")
async def health():
"""Health check endpoint"""
gpu_available = False
if EASYOCR_AVAILABLE:
try:
import torch
gpu_available = torch.cuda.is_available()
except:
pass
return {
"status": "healthy" if (TESSERACT_AVAILABLE or EASYOCR_AVAILABLE) else "degraded",
"tesseract": "available" if TESSERACT_AVAILABLE else "unavailable",
"easyocr": "available" if EASYOCR_AVAILABLE else "unavailable",
"gpu": torch.cuda.is_available() if EASYOCR_AVAILABLE else False
"gpu": gpu_available
}
def preprocess_image(img: Image.Image) -> Image.Image:

View File

@@ -1,10 +1,14 @@
# Core
fastapi==0.104.1
uvicorn[standard]==0.24.0
python-multipart==0.0.6
# OCR - Tesseract only (EasyOCR optional)
pytesseract==0.3.10
easyocr==1.7.1
Pillow==10.1.0
numpy==1.24.3
torch==2.1.0
torchvision==0.16.0
# Optional: EasyOCR (uncomment for full support, requires GPU)
# easyocr==1.7.1
# torch==2.1.0
# torchvision==0.16.0