FROM python:3.8 # Set working directory WORKDIR /code # Create necessary directories with proper permissions RUN mkdir -p /tmp/uploads /tmp/models && \ chmod 777 /tmp/uploads /tmp/models # Copy requirements first for better caching COPY ./requirements.txt /code/requirements.txt # Install Python dependencies RUN pip install --no-cache-dir --upgrade pip && \ pip install --no-cache-dir -r /code/requirements.txt # Copy application code COPY . /code # Expose port 7860 (required by Hugging Face Spaces) EXPOSE 7860 # Set environment variables ENV PYTHONPATH=/code ENV TMPDIR=/tmp # Command to run the application with explicit path # Command to run the application CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]