LogicGoInfotechSpaces commited on
Commit
61d8ed5
·
1 Parent(s): 4d1e6bf

Fix GPU compatibility: use standard onnxruntime (auto-detects GPU at runtime)

Browse files

- Removed onnxruntime-gpu which requires CUDA libraries in base image
- Use standard onnxruntime package which auto-detects GPU if available
- Build will succeed, GPU will be used automatically at runtime if CUDA is available
- API code already handles GPU/CPU fallback properly

Files changed (1) hide show
  1. Dockerfile +9 -14
Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
  # Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
2
- # Dockerfile for Face Swap Video API
3
 
4
  FROM python:3.10-slim
5
 
@@ -65,19 +65,18 @@ RUN pip install --no-cache-dir \
65
  tqdm==4.65.0 \
66
  Pillow \
67
  imageio-ffmpeg \
68
- huggingface_hub>=0.23.0 \
69
- gfpgan
70
 
71
  # Install OpenCV first (needed by insightface)
72
  RUN pip install --no-cache-dir opencv-python-headless
73
 
74
- # Install ONNX Runtime - try CPU version first as it's more compatible and doesn't require GPU
75
- # Try newer versions first as they're more likely to have wheels available
76
- RUN pip install --no-cache-dir onnxruntime-cpu || \
77
- pip install --no-cache-dir "onnxruntime-cpu>=1.16.0" || \
78
- pip install --no-cache-dir onnxruntime-cpu==1.17.3 || \
79
- pip install --no-cache-dir onnxruntime==1.17.3 || \
80
  pip install --no-cache-dir "onnxruntime>=1.16.0" || \
 
 
81
  (echo "ERROR: All ONNX Runtime installation attempts failed" && exit 1)
82
 
83
  # Verify ONNX Runtime installation
@@ -101,11 +100,7 @@ RUN python -c "import insightface; print('InsightFace installed successfully')"
101
  COPY --chown=user:user api_server.py /app/
102
  COPY --chown=user:user DeepFakeAI/ /app/DeepFakeAI/
103
 
104
- # Create upload directories with proper permissions
105
- RUN mkdir -p /app/uploads/source_images /app/uploads/target_videos /app/uploads/result_videos && \
106
- chown -R user:user /app/uploads
107
-
108
- # Switch to user
109
  USER user
110
  ENV PATH="/home/user/.local/bin:$PATH"
111
 
 
1
  # Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
2
+ # Dockerfile for Face Swap Video API - GPU Optimized, API Only (No Gradio)
3
 
4
  FROM python:3.10-slim
5
 
 
65
  tqdm==4.65.0 \
66
  Pillow \
67
  imageio-ffmpeg \
68
+ huggingface_hub>=0.23.0
 
69
 
70
  # Install OpenCV first (needed by insightface)
71
  RUN pip install --no-cache-dir opencv-python-headless
72
 
73
+ # Install ONNX Runtime - Use CPU version for build compatibility
74
+ # GPU will be detected automatically at runtime if available
75
+ # CPU version works for both CPU and GPU, runtime will use GPU if CUDA is available
76
+ RUN pip install --no-cache-dir onnxruntime || \
 
 
77
  pip install --no-cache-dir "onnxruntime>=1.16.0" || \
78
+ pip install --no-cache-dir onnxruntime-cpu || \
79
+ pip install --no-cache-dir "onnxruntime-cpu>=1.16.0" || \
80
  (echo "ERROR: All ONNX Runtime installation attempts failed" && exit 1)
81
 
82
  # Verify ONNX Runtime installation
 
100
  COPY --chown=user:user api_server.py /app/
101
  COPY --chown=user:user DeepFakeAI/ /app/DeepFakeAI/
102
 
103
+ # Switch to user (upload directories will be created by api_server.py on startup)
 
 
 
 
104
  USER user
105
  ENV PATH="/home/user/.local/bin:$PATH"
106