FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04 # Use the official Python image as the base FROM python:3.10-slim # Set environment variables ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 # Set working directory WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ git \ ffmpeg \ libsm6 \ libxext6 \ && rm -rf /var/lib/apt/lists/* # Install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Clone YOLOv7 repository RUN git clone https://github.com/WongKinYiu/yolov7.git # Copy application files COPY . . # Modify torch.load to set weights_only=False RUN sed -i 's/torch.load(\(.*\))/torch.load(\1, weights_only=False)/g' yolov7/models/experimental.py # Expose the port Streamlit runs on EXPOSE 8501 # Run the application CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"] #CMD ["streamlit", "run", "app.py"]