# deploy/tgi_space/Dockerfile.fallback # # Fallback: custom transformers FastAPI server for Spaces where TGI fails. # Uses Qwen/Qwen2.5-0.5B-Instruct (smaller model, faster on CPU, ~1GB). # # Deploy by renaming to Dockerfile and uploading to the failing Space: # cp deploy/tgi_space/Dockerfile.fallback deploy/tgi_space/Dockerfile # # then re-upload via setup_spaces.py --space-name tgi-persona-synth FROM python:3.11-slim WORKDIR /app # Install inference deps — two stages to keep --index-url unambiguous RUN pip install --no-cache-dir fastapi "uvicorn[standard]" httpx transformers accelerate RUN pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu COPY app.py . ENV PORT=7860 # Use 0.5B model — smaller, faster on CPU, still generates valid JSON personas ENV MODEL_ID=Qwen/Qwen2.5-0.5B-Instruct ENV HF_HOME=/data ENV HUGGINGFACE_HUB_CACHE=/data/hub ENV MAX_NEW_TOKENS=600 # Expose port required by HF Spaces EXPOSE 7860 CMD ["python", "app.py"]