Spaces:
Sleeping
Sleeping
| # 1. Base Image | |
| FROM python:3.11-slim | |
| # 2. Set the working directory | |
| WORKDIR /app | |
| # 3. Install PyTorch FIRST | |
| RUN pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu | |
| # 4. Install API dependencies SECOND | |
| RUN pip install --no-cache-dir fastapi uvicorn transformers pillow pydantic requests | |
| # 5. THE FIX: Pre-download the Plant weights AND forcefully load the Google processor | |
| RUN python -c "from transformers import pipeline; pipeline('image-classification', model='linkanjarad/mobilenet_v2_1.0_224-plant-disease-identification', image_processor='google/mobilenet_v2_1.0_224')" | |
| # 6. Copy code and set path | |
| COPY app.py /app/app.py | |
| ENV PYTHONPATH=/app | |
| # 7. Expose port | |
| EXPOSE 7860 | |
| # 8. Start the node | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |