# HuggingFace Space — Docker SDK # Roda FastAPI/uvicorn na porta 7860 (padrao HF Spaces) com o backend Python # do DissertaAi: 10 modelos BERTimbau (5 jbcs2025 + 5 local_calibrado opcional) # e API /corrigir. # # HF Spaces Free CPU: 16GB RAM, 2 vCPU. Cold start ~2-3min, request ~60-90s. FROM python:3.11-slim WORKDIR /app # Dependencias do sistema (mínimas) RUN apt-get update && apt-get install -y --no-install-recommends \ git curl && rm -rf /var/lib/apt/lists/* # Python deps — instalar torch CPU primeiro (menor) COPY requirements.txt . RUN pip install --no-cache-dir --upgrade pip && \ pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu && \ pip install --no-cache-dir -r requirements.txt # Codigo COPY api.py corretor.py ./ COPY heuristica_c5.py ./ # Pasta pra HF cache dos modelos (precisa ser writable) ENV HF_HOME=/tmp/hf_cache ENV TRANSFORMERS_CACHE=/tmp/hf_cache ENV DISSERO_TORCH_THREADS=2 ENV PYTHONIOENCODING=utf-8 ENV PYTHONUTF8=1 # HF Spaces espera porta 7860 EXPOSE 7860 CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "7860"]