Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +16 -15
Dockerfile
CHANGED
@@ -4,19 +4,13 @@ FROM python:3.10-slim
|
|
4 |
# Set environment variables
|
5 |
ENV PYTHONDONTWRITEBYTECODE=1 \
|
6 |
PYTHONUNBUFFERED=1 \
|
7 |
-
HF_HOME=/
|
8 |
-
TRANSFORMERS_CACHE=/home/user/.cache/huggingface/transformers \
|
9 |
TRANSFORMERS_VERBOSITY=error
|
10 |
|
11 |
-
#
|
12 |
-
RUN useradd -m -u 1000 user
|
13 |
-
|
14 |
-
# Set working directory
|
15 |
WORKDIR /app
|
16 |
-
|
17 |
-
|
18 |
-
RUN mkdir -p /home/user/.cache/huggingface /app/models/suno-bark /app/models/sentiment && \
|
19 |
-
chmod -R 777 /home/user/.cache /app/models
|
20 |
|
21 |
# Install OS dependencies
|
22 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
@@ -31,16 +25,23 @@ RUN pip install --no-cache-dir --root-user-action=ignore -U pip && \
|
|
31 |
"protobuf" && \
|
32 |
pip install --no-cache-dir --root-user-action=ignore -r requirements.txt
|
33 |
|
34 |
-
#
|
35 |
RUN pip install soundfile
|
36 |
|
37 |
-
#
|
38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
# Copy application source code
|
41 |
-
COPY
|
42 |
|
43 |
-
# Expose port
|
44 |
EXPOSE 7860
|
45 |
|
46 |
# Launch app using Uvicorn
|
|
|
4 |
# Set environment variables
|
5 |
ENV PYTHONDONTWRITEBYTECODE=1 \
|
6 |
PYTHONUNBUFFERED=1 \
|
7 |
+
HF_HOME=/app/.cache \
|
|
|
8 |
TRANSFORMERS_VERBOSITY=error
|
9 |
|
10 |
+
# Set working directory and create necessary folders
|
|
|
|
|
|
|
11 |
WORKDIR /app
|
12 |
+
RUN mkdir -p /app/.cache /app/models/suno-bark /app/models/sentiment && \
|
13 |
+
chmod -R 777 /app/.cache /app/models
|
|
|
|
|
14 |
|
15 |
# Install OS dependencies
|
16 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
25 |
"protobuf" && \
|
26 |
pip install --no-cache-dir --root-user-action=ignore -r requirements.txt
|
27 |
|
28 |
+
# Install soundfile
|
29 |
RUN pip install soundfile
|
30 |
|
31 |
+
# Download Bark TTS model using snapshot_download
|
32 |
+
RUN python3 -c "\
|
33 |
+
from huggingface_hub import snapshot_download; \
|
34 |
+
snapshot_download(repo_id='suno/bark-small', local_dir='/app/models/suno-bark', local_dir_use_symlinks=False)"
|
35 |
+
|
36 |
+
# Download sentiment analysis model using snapshot_download
|
37 |
+
RUN python3 -c "\
|
38 |
+
from huggingface_hub import snapshot_download; \
|
39 |
+
snapshot_download(repo_id='cardiffnlp/twitter-xlm-roberta-base-sentiment', local_dir='/app/models/sentiment', local_dir_use_symlinks=False)"
|
40 |
|
41 |
# Copy application source code
|
42 |
+
COPY app.py .
|
43 |
|
44 |
+
# Expose port for the application
|
45 |
EXPOSE 7860
|
46 |
|
47 |
# Launch app using Uvicorn
|