gadhalevy commited on
Commit
adcdf4f
Β·
1 Parent(s): 7602b6c
Files changed (1) hide show
  1. Dockerfile +6 -43
Dockerfile CHANGED
@@ -65,48 +65,11 @@ RUN pip install --no-cache-dir --force-reinstall "numpy>=1.23.5,<1.24"
65
  COPY avatar_streamlit.py /app/
66
 
67
  # ---------- Fix NumPy Compatibility in SadTalker ----------
68
- RUN python3 << 'EOF'
69
- import os
70
- import re
71
-
72
- sadtalker_path = '/app/SadTalker'
73
-
74
- # Fix np.float
75
- for root, dirs, files in os.walk(sadtalker_path):
76
- for file in files:
77
- if file.endswith('.py'):
78
- filepath = os.path.join(root, file)
79
- try:
80
- with open(filepath, 'r') as f:
81
- content = f.read()
82
- new_content = re.sub(r'\bnp\.float\b(?!\d)', 'np.float64', content)
83
- if new_content != content:
84
- with open(filepath, 'w') as f:
85
- f.write(new_content)
86
- except:
87
- pass
88
-
89
- # Fix preprocess.py
90
- preprocess_file = os.path.join(sadtalker_path, 'src/face3d/util/preprocess.py')
91
- try:
92
- with open(preprocess_file, 'r') as f:
93
- content = f.read()
94
-
95
- content = content.replace(
96
- 'warnings.filterwarnings("ignore", category=np.VisibleDeprecationWarning)',
97
- '# warnings.filterwarnings("ignore", category=np.VisibleDeprecationWarning)'
98
- )
99
- content = content.replace(
100
- "trans_params = np.array([w0, h0, s, t[0], t[1]])",
101
- "trans_params = np.array([w0, h0, s, float(t[0]), float(t[1])])"
102
- )
103
-
104
- with open(preprocess_file, 'w') as f:
105
- f.write(content)
106
- print("βœ… SadTalker fixes applied!")
107
- except Exception as e:
108
- print(f"⚠️ Could not fix preprocess.py: {e}")
109
- EOF
110
 
111
  # ---------- Preload Coqui Model (Skip on build to save memory) ----------
112
  # Model will download on first run instead
@@ -116,4 +79,4 @@ EOF
116
  EXPOSE 8501
117
  CMD ["streamlit", "run", "avatar_streamlit.py", "--server.port=8501", "--server.address=0.0.0.0"]
118
 
119
- # FORCE_REBUILD: 2025-01-04-v2
 
65
  COPY avatar_streamlit.py /app/
66
 
67
  # ---------- Fix NumPy Compatibility in SadTalker ----------
68
+ RUN cd /app/SadTalker && \
69
+ find . -name "*.py" -type f -exec sed -i 's/\bnp\.float\b/np.float64/g' {} + && \
70
+ sed -i 's/warnings.filterwarnings("ignore", category=np.VisibleDeprecationWarning)/# warnings.filterwarnings("ignore", category=np.VisibleDeprecationWarning)/' src/face3d/util/preprocess.py && \
71
+ sed -i 's/trans_params = np.array(\[w0, h0, s, t\[0\], t\[1\]\])/trans_params = np.array([w0, h0, s, float(t[0]), float(t[1])])/' src/face3d/util/preprocess.py && \
72
+ echo "βœ… SadTalker fixes applied!"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
 
74
  # ---------- Preload Coqui Model (Skip on build to save memory) ----------
75
  # Model will download on first run instead
 
79
  EXPOSE 8501
80
  CMD ["streamlit", "run", "avatar_streamlit.py", "--server.port=8501", "--server.address=0.0.0.0"]
81
 
82
+ # FORCE_REBUILD: 2025-01-04-v4