Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +14 -0
Dockerfile
CHANGED
|
@@ -28,6 +28,20 @@ RUN apt-get update && apt-get install -y \
|
|
| 28 |
RUN mkdir -p /tmp/uploads /tmp/results /tmp/huggingface/transformers /tmp/huggingface/datasets /tmp/.u2net \
|
| 29 |
&& chmod -R 777 /tmp/uploads /tmp/results /tmp/huggingface /tmp/.u2net
|
| 30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
# Copy requirements file and install dependencies
|
| 32 |
COPY requirements.txt .
|
| 33 |
RUN pip install --no-cache-dir -U pip && \
|
|
|
|
| 28 |
RUN mkdir -p /tmp/uploads /tmp/results /tmp/huggingface/transformers /tmp/huggingface/datasets /tmp/.u2net \
|
| 29 |
&& chmod -R 777 /tmp/uploads /tmp/results /tmp/huggingface /tmp/.u2net
|
| 30 |
|
| 31 |
+
# Install huggingface_hub early for model downloads
|
| 32 |
+
RUN pip install --no-cache-dir huggingface_hub==0.23.0
|
| 33 |
+
|
| 34 |
+
# Pre-download models with error handling
|
| 35 |
+
RUN if [ -z "$HF_TOKEN" ]; then \
|
| 36 |
+
echo "ERROR: HF_TOKEN is not set. Model pre-download will fail."; \
|
| 37 |
+
exit 1; \
|
| 38 |
+
else \
|
| 39 |
+
python -c "from huggingface_hub import login, snapshot_download; login(token='$HF_TOKEN'); \
|
| 40 |
+
snapshot_download(repo_id='Intel/dpt-large', cache_dir='/tmp/huggingface', token='$HF_TOKEN')" && \
|
| 41 |
+
python -c "from huggingface_hub import snapshot_download; \
|
| 42 |
+
snapshot_download(repo_id='depth-anything/Depth-Anything-V2-Tiny-hf', cache_dir='/tmp/huggingface', token='$HF_TOKEN')"; \
|
| 43 |
+
fi
|
| 44 |
+
|
| 45 |
# Copy requirements file and install dependencies
|
| 46 |
COPY requirements.txt .
|
| 47 |
RUN pip install --no-cache-dir -U pip && \
|