LogicGoInfotechSpaces commited on
Commit
4d64af2
·
1 Parent(s): 7ed02ff

feat(models): bake inswapper_128.onnx into image via explicit COPY and include file via LFS

Browse files
Files changed (1) hide show
  1. Dockerfile +8 -1
Dockerfile CHANGED
@@ -101,6 +101,8 @@ RUN python -c "import insightface; print('InsightFace installed successfully')"
101
  COPY --chown=user:user api_server.py /app/
102
  COPY --chown=user:user firebase_app_check.py /app/
103
  COPY --chown=user:user DeepFakeAI/ /app/DeepFakeAI/
 
 
104
 
105
  # Create upload directories with proper permissions before switching to user
106
  RUN mkdir -p /app/uploads/source_images /app/uploads/target_videos /app/uploads/result_videos && \
@@ -111,12 +113,17 @@ RUN mkdir -p /app/.assets/models && chown -R user:user /app/.assets
111
 
112
  # Optional preload of InsightFace inswapper_128.onnx (skips if no URL provided)
113
  ARG INSWAPPER_URL=""
 
114
  ENV INSIGHTFACE_HOME="/home/user/.insightface"
115
  ENV INSWAPPER_PATH="/app/DeepFakeAI/.assets/models/inswapper_128.onnx"
116
  RUN set -e; mkdir -p /app/DeepFakeAI/.assets/models /home/user/.insightface/models; \
117
  if [ -n "$INSWAPPER_URL" ]; then \
118
  echo "Downloading inswapper_128.onnx from $INSWAPPER_URL"; \
119
- curl -fsSL "$INSWAPPER_URL" -o "$INSWAPPER_PATH" || echo "Warning: download failed, continuing without preloaded model"; \
 
 
 
 
120
  else \
121
  echo "No INSWAPPER_URL provided; skipping model download"; \
122
  fi; \
 
101
  COPY --chown=user:user api_server.py /app/
102
  COPY --chown=user:user firebase_app_check.py /app/
103
  COPY --chown=user:user DeepFakeAI/ /app/DeepFakeAI/
104
+ # Ensure inswapper_128.onnx is baked into the image if present in repo
105
+ COPY --chown=user:user DeepFakeAI/.assets/models/inswapper_128.onnx /app/DeepFakeAI/.assets/models/inswapper_128.onnx
106
 
107
  # Create upload directories with proper permissions before switching to user
108
  RUN mkdir -p /app/uploads/source_images /app/uploads/target_videos /app/uploads/result_videos && \
 
113
 
114
  # Optional preload of InsightFace inswapper_128.onnx (skips if no URL provided)
115
  ARG INSWAPPER_URL=""
116
+ ARG INSWAPPER_TOKEN=""
117
  ENV INSIGHTFACE_HOME="/home/user/.insightface"
118
  ENV INSWAPPER_PATH="/app/DeepFakeAI/.assets/models/inswapper_128.onnx"
119
  RUN set -e; mkdir -p /app/DeepFakeAI/.assets/models /home/user/.insightface/models; \
120
  if [ -n "$INSWAPPER_URL" ]; then \
121
  echo "Downloading inswapper_128.onnx from $INSWAPPER_URL"; \
122
+ if [ -n "$INSWAPPER_TOKEN" ]; then \
123
+ curl -fsSL -H "Authorization: Bearer $INSWAPPER_TOKEN" "$INSWAPPER_URL" -o "$INSWAPPER_PATH" || echo "Warning: tokenized download failed, continuing without preloaded model"; \
124
+ else \
125
+ curl -fsSL "$INSWAPPER_URL" -o "$INSWAPPER_PATH" || echo "Warning: download failed, continuing without preloaded model"; \
126
+ fi; \
127
  else \
128
  echo "No INSWAPPER_URL provided; skipping model download"; \
129
  fi; \