Spaces:
Sleeping
Sleeping
| FROM python:3.11-slim | |
| WORKDIR /app | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| gcc \ | |
| g++ \ | |
| curl \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy requirements | |
| COPY requirements.txt . | |
| # Install Python dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy application code | |
| COPY app/ ./app/ | |
| COPY scripts/ ./scripts/ | |
| # Copy model artifacts into HF persistent storage | |
| COPY artifacts/models /data/artifacts/models | |
| # Create Hugging Face persistent storage directories | |
| RUN mkdir -p /data/artifacts/metrics \ | |
| && mkdir -p /data/artifacts/reports \ | |
| && mkdir -p /data/artifacts/feedback | |
| ENV MODEL_ARTIFACT_DIR=/data/artifacts/models | |
| ENV DATASET_DIR=/data/learning_outcome_os_dataset_v2 | |
| ENV DATASET_REPO_ID=orderlymirror/lo | |
| ENV METRICS_DIR=/data/artifacts/metrics | |
| ENV REPORTS_DIR=/data/artifacts/reports | |
| ENV FEEDBACK_DIR=/data/artifacts/feedback | |
| ENV LOG_LEVEL=INFO | |
| ENV SEED=20260520 | |
| ENV LOW_CONFIDENCE_THRESHOLD=0.55 | |
| ENV LOG_SALT=hf-space-default-salt | |
| # Expose the Hugging Face default Space port | |
| EXPOSE 7860 | |
| # Health check | |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ | |
| CMD curl -f http://localhost:7860/ai/v2/health || exit 1 | |
| # Run the FastAPI application with uvicorn | |
| CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"] | |