Spaces:
Runtime error
Runtime error
File size: 1,606 Bytes
2068bbe 7054b88 c9d5426 2ec6b08 7054b88 2389f3b d1416af c9d5426 2389f3b 7054b88 2389f3b 0cb9548 2068bbe 7054b88 ce895e3 7054b88 13f00ab 2068bbe 202b453 ef1a5fb 552b5a0 2068bbe 2389f3b ec4f4ea 2389f3b b8e2812 552b5a0 2389f3b 2068bbe 2389f3b 13f00ab 2068bbe 552b5a0 ef1a5fb |
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 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# Use Python 3.10 slim image
FROM python:3.10-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
HF_HOME=/app/.cache \
TRANSFORMERS_VERBOSITY=error
# Set working directory and create necessary folders
WORKDIR /app
RUN mkdir -p /app/.cache /app/models/suno-bark /app/models/sentiment && \
chmod -R 777 /app/.cache /app/models
# Install OS dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
libsndfile1 ffmpeg ca-certificates && \
rm -rf /var/lib/apt/lists/*
# Copy requirements and install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir --root-user-action=ignore -U pip && \
pip install --no-cache-dir --root-user-action=ignore \
"numpy<2" \
"protobuf" && \
pip install --no-cache-dir --root-user-action=ignore -r requirements.txt
# Install soundfile
RUN pip install soundfile
# Download Bark TTS model using snapshot_download
RUN python3 -c "\
from huggingface_hub import snapshot_download; \
snapshot_download(repo_id='suno/bark-small', local_dir='/app/models/suno-bark', local_dir_use_symlinks=False)"
# Download sentiment analysis model using snapshot_download
RUN python3 -c "\
from huggingface_hub import snapshot_download; \
snapshot_download(repo_id='cardiffnlp/twitter-xlm-roberta-base-sentiment', local_dir='/app/models/sentiment', local_dir_use_symlinks=False)"
# Copy application source code
COPY app.py .
# Expose port for the application
EXPOSE 7860
# Launch app using Uvicorn
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|