File size: 983 Bytes
ebe934f ebb06ed 1ea03d4 a42a9e0 69c362c 1ea03d4 14d263b 5935cf6 ebe934f | 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 | FROM python:3.11-slim
WORKDIR /app
# System deps for sentence-transformers (tokenizers uses Rust bindings)
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Pre-download models so first request isn't slow on HF Spaces
RUN python -c "\
from sentence_transformers import SentenceTransformer; \
from transformers import T5Tokenizer, pipeline; \
SentenceTransformer('all-MiniLM-L6-v2'); \
tok = T5Tokenizer.from_pretrained('t5-small'); \
pipe = pipeline('text-classification', model='vectara/hallucination_evaluation_model', tokenizer=tok, trust_remote_code=True); \
pipe(['test document test response'])"
COPY knowledge/ ./knowledge/
COPY backend/ ./backend/
COPY ui/ ./ui/
WORKDIR /app/backend
# HF Spaces requires port 7860
ENV PORT=7860
EXPOSE 7860
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|