# Use Python 3.9 as the base image FROM python:3.9 # Set the working directory WORKDIR /app # Install system dependencies (FFmpeg is required for audio processing) RUN apt-get update && apt-get install -y ffmpeg # Copy requirements and install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy the rest of the application code COPY . . # Create a cache directory for Hugging Face models and set permissions # This prevents permission errors when the model tries to download RUN mkdir -p /app/cache && chmod 777 /app/cache ENV TRANSFORMERS_CACHE=/app/cache ENV HF_HOME=/app/cache # Expose the port (Hugging Face Spaces uses 7860) EXPOSE 7860 # Command to run the application using Uvicorn CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]