shavkatvicc commited on
Commit
a533b21
·
verified ·
1 Parent(s): 71b3117

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +7 -6
Dockerfile CHANGED
@@ -9,19 +9,19 @@ RUN apt-get update && apt-get install -y \
9
  git \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
- # Set environment variables
13
  ENV TRANSFORMERS_CACHE=/app/hf_cache
14
  ENV HF_HOME=/app/hf_cache
15
  ENV HF_DATASETS_CACHE=/app/hf_cache
16
 
17
- # Install Python dependencies
18
  COPY requirements.txt ./
19
  RUN pip install --no-cache-dir -r requirements.txt
20
 
21
- # Pre-download the model and tokenizer
22
  RUN python -c "from transformers import AutoTokenizer, AutoModelForSequenceClassification; \
23
- AutoTokenizer.from_pretrained('finiteautomata/bertweet-base-sentiment-analysis'); \
24
- AutoModelForSequenceClassification.from_pretrained('finiteautomata/bertweet-base-sentiment-analysis')"
25
 
26
  # Copy app code
27
  COPY app.py ./
@@ -29,8 +29,9 @@ COPY app.py ./
29
  # Expose Streamlit port
30
  EXPOSE 8501
31
 
32
- # Healthcheck to make Hugging Face know it's alive
33
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
34
 
35
  # Start Streamlit
36
  ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
 
9
  git \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
+ # Set environment variables for cache
13
  ENV TRANSFORMERS_CACHE=/app/hf_cache
14
  ENV HF_HOME=/app/hf_cache
15
  ENV HF_DATASETS_CACHE=/app/hf_cache
16
 
17
+ # Copy dependency list and install Python packages
18
  COPY requirements.txt ./
19
  RUN pip install --no-cache-dir -r requirements.txt
20
 
21
+ # Pre-download the Hugging Face model and tokenizer
22
  RUN python -c "from transformers import AutoTokenizer, AutoModelForSequenceClassification; \
23
+ AutoTokenizer.from_pretrained('finiteautomata/bertweet-base-sentiment-analysis', cache_dir='/app/hf_cache'); \
24
+ AutoModelForSequenceClassification.from_pretrained('finiteautomata/bertweet-base-sentiment-analysis', cache_dir='/app/hf_cache')"
25
 
26
  # Copy app code
27
  COPY app.py ./
 
29
  # Expose Streamlit port
30
  EXPOSE 8501
31
 
32
+ # Healthcheck (optional)
33
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
34
 
35
  # Start Streamlit
36
  ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
37
+