# =============================== # Base image # =============================== FROM python:3.10-slim # Set working directory WORKDIR /app # =============================== # Install system dependencies # =============================== RUN apt-get update && apt-get install -y --no-install-recommends \ git \ && rm -rf /var/lib/apt/lists/* # =============================== # Copy dependency list and install packages # =============================== COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # =============================== # Pre-download and cache model weights # =============================== RUN python -c "from transformers import AutoTokenizer, AutoModelForSequenceClassification; \ model='fakespot-ai/roberta-base-ai-text-detection-v1'; \ AutoTokenizer.from_pretrained(model, cache_dir='/app/model'); \ AutoModelForSequenceClassification.from_pretrained(model, cache_dir='/app/model')" # =============================== # Copy application files # =============================== COPY . . # =============================== # Environment configuration # =============================== ENV TRANSFORMERS_CACHE=/app/model \ HF_HOME=/app/model \ PYTHONUNBUFFERED=1 # =============================== # Expose Gradio default port # =============================== EXPOSE 7860 # =============================== # Start the Gradio app # =============================== CMD ["python", "app.py"]