black44 commited on
Commit
7b8c16b
·
verified ·
1 Parent(s): 13f00ab

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -0
Dockerfile CHANGED
@@ -1,13 +1,28 @@
 
1
  FROM python:3.9-slim
2
 
 
3
  WORKDIR /app
4
 
 
5
  COPY requirements.txt .
6
 
 
7
  RUN pip install --no-cache-dir -r requirements.txt
8
 
 
 
 
 
 
 
 
 
9
  COPY app.py .
10
 
 
 
 
11
  EXPOSE 7860
12
 
13
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # Use the official Python 3.9 slim image as the base image
2
  FROM python:3.9-slim
3
 
4
+ # Set the working directory inside the container
5
  WORKDIR /app
6
 
7
+ # Copy the requirements file into the container
8
  COPY requirements.txt .
9
 
10
+ # Install the required Python dependencies
11
  RUN pip install --no-cache-dir -r requirements.txt
12
 
13
+ # Download the model and tokenizer
14
+ RUN mkdir -p /app/models && \
15
+ python -c "from transformers import AutoTokenizer, AutoProcessor; \
16
+ tokenizer = AutoTokenizer.from_pretrained('suno/bark'); \
17
+ processor = AutoProcessor.from_pretrained('suno/bark'); \
18
+ tokenizer.save_pretrained('/app/models/suno-bark'); \
19
+ processor.save_pretrained('/app/models/suno-bark')"
20
+
21
  COPY app.py .
22
 
23
+ ENV TRANSFORMERS_CACHE=/app/.cache
24
+ ENV HF_HOME=/app/.cache
25
+
26
  EXPOSE 7860
27
 
28
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]