PACWIN2027/Form_Summary_Extraction
0
1FROM python:3.12-slim
2
3# tesseract + the Punjabi (Gurmukhi) model power the OCR fallback for scanned
4# PDFs. Documents that carry a text layer never touch it.
5RUN apt-get update && apt-get install -y --no-install-recommends \
6 tesseract-ocr tesseract-ocr-pan tesseract-ocr-eng \
7 && rm -rf /var/lib/apt/lists/*
8
9WORKDIR /app
10
11COPY requirements.txt .
12RUN pip install --no-cache-dir -r requirements.txt
13
14COPY extractor ./extractor
15COPY static ./static
16COPY app.py extract.py ./
17
18# UID 1000 is what Hugging Face Spaces expects; harmless everywhere else.
19RUN mkdir -p /app/output && useradd -m -u 1000 runner && chown -R runner /app
20USER runner
21
22ENV PORT=8000 \
23 WORK_DIR=/tmp/electoral-extractor \
24 TRANSLATION_CACHE=/tmp/translation_cache.json \
25 MAX_UPLOAD_MB=80 \
26 PYTHONUNBUFFERED=1
27
28EXPOSE 8000
29CMD ["sh", "-c", "uvicorn app:app --host 0.0.0.0 --port ${PORT} --timeout-keep-alive 120"]
30 