Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +9 -9
Dockerfile
CHANGED
|
@@ -9,25 +9,25 @@ WORKDIR /app
|
|
| 9 |
|
| 10 |
# Python deps
|
| 11 |
COPY requirements.txt .
|
| 12 |
-
RUN pip install --no-cache-dir -r requirements.txt &&
|
|
|
|
| 13 |
|
| 14 |
-
# Download model from Google Drive
|
| 15 |
-
# Put your Drive FILE ID here (from the link you sent)
|
| 16 |
ARG MODEL_DRIVE_ID=17c8ySOwxuQZsWRAFplqly4wbDaQHCQPC
|
| 17 |
ENV MODEL_DRIVE_ID=${MODEL_DRIVE_ID}
|
| 18 |
-
RUN gdown https://drive.google.com/uc?id=
|
| 19 |
|
| 20 |
# App
|
| 21 |
COPY server.py /app/server.py
|
| 22 |
|
| 23 |
-
#
|
| 24 |
ENV MODEL_PATH=/app/spoilage_model.pth
|
| 25 |
ENV IMG_SIZE=224
|
| 26 |
ENV CLASS_NAMES="fresh,spoiled"
|
|
|
|
| 27 |
|
| 28 |
-
#
|
| 29 |
-
ENV PORT=7860
|
| 30 |
EXPOSE 7860
|
| 31 |
|
| 32 |
-
# Run
|
| 33 |
-
CMD ["
|
|
|
|
| 9 |
|
| 10 |
# Python deps
|
| 11 |
COPY requirements.txt .
|
| 12 |
+
RUN pip install --no-cache-dir -r requirements.txt && \
|
| 13 |
+
pip install --no-cache-dir gdown==5.2.0
|
| 14 |
|
| 15 |
+
# Download model from Google Drive (make sure file is shared: Anyone with the link)
|
|
|
|
| 16 |
ARG MODEL_DRIVE_ID=17c8ySOwxuQZsWRAFplqly4wbDaQHCQPC
|
| 17 |
ENV MODEL_DRIVE_ID=${MODEL_DRIVE_ID}
|
| 18 |
+
RUN gdown --fuzzy "https://drive.google.com/uc?id=17c8ySOwxuQZsWRAFplqly4wbDaQHCQPC" -O /app/spoilage_model.pth
|
| 19 |
|
| 20 |
# App
|
| 21 |
COPY server.py /app/server.py
|
| 22 |
|
| 23 |
+
# App env
|
| 24 |
ENV MODEL_PATH=/app/spoilage_model.pth
|
| 25 |
ENV IMG_SIZE=224
|
| 26 |
ENV CLASS_NAMES="fresh,spoiled"
|
| 27 |
+
ENV PYTHONUNBUFFERED=1
|
| 28 |
|
| 29 |
+
# Ports
|
|
|
|
| 30 |
EXPOSE 7860
|
| 31 |
|
| 32 |
+
# Run (bind to dynamic $PORT if provided, else fallback 7860)
|
| 33 |
+
CMD ["sh", "-c", "uvicorn server:app --host 0.0.0.0 --port ${PORT:-7860}"]
|