File size: 1,396 Bytes
73a82ff
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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 and dataset into HF persistent storage
COPY artifacts/models /data/artifacts/models
COPY learning_outcome_os_dataset_v2 /data/learning_outcome_os_dataset_v2

# 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 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"]