Spaces:
Sleeping
Sleeping
| # Use Python 3.9 slim image for smaller size | |
| FROM python:3.9-slim | |
| # Set working directory | |
| WORKDIR /app | |
| # Install system dependencies for OpenCV | |
| RUN apt-get update && apt-get install -y \ | |
| libglib2.0-0 \ | |
| libsm6 \ | |
| libxext6 \ | |
| libxrender-dev \ | |
| libgomp1 \ | |
| libglib2.0-0 \ | |
| libgl1-mesa-glx \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy requirements first for better caching | |
| COPY requirements.txt . | |
| # Install Python dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy all files | |
| COPY . . | |
| # Create model directory and move model file to expected location | |
| RUN mkdir -p model && \ | |
| if [ -f "best_model.pth" ]; then \ | |
| mv best_model.pth model/best_model.pth && \ | |
| echo "Model file moved to model/best_model.pth"; \ | |
| else \ | |
| echo "No model file found - will use fallback segmentation"; \ | |
| fi | |
| # Expose the port that the app runs on | |
| EXPOSE 7860 | |
| # Command to run the application | |
| CMD ["python", "app.py"] |