FROM pytorch/pytorch:2.0.0-cuda11.7-cudnn8-runtime WORKDIR /code # Install system dependencies RUN apt-get update && apt-get install -y \ git \ wget \ ffmpeg \ libsndfile1 \ build-essential \ python3-dev \ && rm -rf /var/lib/apt/lists/* # Create cache directory with proper permissions RUN mkdir -p /.cache/huggingface && chmod -R 777 /.cache # Clean pip cache and install dependencies RUN pip cache purge COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Clone and install IndicTransToolkit RUN git clone https://github.com/VarunGumma/IndicTransToolkit \ && cd IndicTransToolkit \ && pip install --editable ./ # Copy application code COPY . . # Create directories and set permissions RUN mkdir -p templates static/audio \ && chmod -R 777 static/audio # Set environment variables ENV PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:32 ENV TRANSFORMERS_CACHE=/.cache/huggingface/hub ENV HF_HOME=/.cache/huggingface # Expose port EXPOSE 7860 # Command to run the application CMD ["python", "app.py"]