# Use the official Python 3.9 image FROM python:3.9 # Set the working directory WORKDIR /code # Copy requirements and install dependencies COPY ./requirements.txt /code/requirements.txt RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt # Copy the application code COPY . /code # Create a non-root user (security requirement for HF Spaces) RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH # Expose the Gradio port EXPOSE 7860 # Command to run the application CMD ["python", "app.py"]