Spaces:
Sleeping
Sleeping
VarunRS5457
Add HF Spaces deployment, batch processing, session cleanup, and UI enhancements
436fb0c | FROM python:3.11-slim | |
| # Prevent Python from writing .pyc files and enable unbuffered output | |
| ENV PYTHONDONTWRITEBYTECODE=1 \ | |
| PYTHONUNBUFFERED=1 | |
| WORKDIR /app | |
| # Install system dependencies required by pyreadstat (needs C compiler) | |
| RUN apt-get update && \ | |
| apt-get install -y --no-install-recommends gcc g++ && \ | |
| rm -rf /var/lib/apt/lists/* | |
| # Install Python dependencies first (layer caching) | |
| COPY pyproject.toml ./ | |
| RUN pip install --no-cache-dir . | |
| # Copy application code | |
| COPY app/ ./app/ | |
| COPY templates/ ./templates/ | |
| COPY scripts/ ./scripts/ | |
| # Create runtime directories and make them writable for non-root user | |
| RUN mkdir -p uploads output audit_logs training_data && \ | |
| chmod -R 777 uploads output audit_logs training_data | |
| # HF Spaces requires port 7860 | |
| EXPOSE 7860 | |
| # HF Spaces runs containers as uid 1000 | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| # Run with uvicorn on HF Spaces default port | |
| CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"] | |