# Use PyTorch as base image (comes with CUDA support in the GPU variant) FROM pytorch/pytorch:2.0.1-cuda11.7-cudnn8-runtime # Set working directory WORKDIR /app # Set environment variables ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ KMP_DUPLICATE_LIB_OK=TRUE \ DEBIAN_FRONTEND=noninteractive \ TZ=UTC # Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ ffmpeg \ libsndfile1 \ build-essential \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* # Create directory for model caching RUN mkdir -p /root/.cache/huggingface # Copy requirements file COPY requirements.txt . # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Copy application code COPY profanity_detector.py . # Expose the Gradio port EXPOSE 7860 # Command to run the application CMD ["python", "profanity_detector.py"]