File size: 1,004 Bytes
54f8ddb
 
 
 
 
 
 
12ec497
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54f8ddb
 
 
 
 
 
 
 
 
 
 
 
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
FROM python:3.11-slim

WORKDIR /app

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Configure Hugging Face cache directories with write access
ENV HF_HOME=/app/hf_cache \
    TRANSFORMERS_CACHE=/app/hf_cache \
    HF_DATASETS_CACHE=/app/hf_cache
RUN mkdir -p /app/hf_cache

# Pre-download SigLIP model weights and processor during build
RUN python - <<'PY'
from transformers import AutoModel, AutoProcessor
model = "google/siglip2-base-patch16-384"
print("Downloading", model)
AutoProcessor.from_pretrained(model)
AutoModel.from_pretrained(model)
print("Model assets cached")
PY

COPY . .

ENV IMAGE_EMBEDDINGS_PATH=/app/embeddings/image_embeddings.parquet
ENV CAPTION_EMBEDDINGS_PATH=/app/embeddings/caption_embeddings.parquet
ENV SIGLIP_MODEL=google/siglip2-base-patch16-384
ENV IMAGE_SCORE_WEIGHT=0.3
ENV CAPTION_SCORE_WEIGHT=0.2
ENV NLP_SCORE_WEIGHT=0.5
ENV NLP_BOOST_FACTOR=2.0

EXPOSE 7860
CMD ["uvicorn", "search_service:app", "--host", "0.0.0.0", "--port", "7860"]