Faham commited on
Commit
e2e4e08
·
1 Parent(s): 0aa9e15

FIX:moviepy dependency issues

Browse files
Files changed (6) hide show
  1. .dockerignore +30 -85
  2. Dockerfile +14 -1
  3. app.py +0 -1
  4. pyproject.toml +1 -1
  5. requirements.txt +0 -0
  6. uv.lock +1 -1
.dockerignore CHANGED
@@ -1,34 +1,26 @@
1
- # Git
2
- .git
3
- .gitignore
4
- .gitattributes
5
-
6
  # Python
7
- __pycache__
8
- *.pyc
9
- *.pyo
10
- *.pyd
11
  .Python
12
- env
13
- pip-log.txt
14
- pip-delete-this-directory.txt
15
- .tox
16
- .coverage
17
- .coverage.*
18
- .cache
19
- nosetests.xml
20
- coverage.xml
21
- *.cover
22
- *.log
23
- .git
24
- .mypy_cache
25
- .pytest_cache
26
- .hypothesis
27
-
28
- # Jupyter Notebook
29
- .ipynb_checkpoints
30
-
31
- # Environment variables
32
  .env
33
  .venv
34
  env/
@@ -46,68 +38,21 @@ venv.bak/
46
 
47
  # OS
48
  .DS_Store
49
- .DS_Store?
50
- ._*
51
- .Spotlight-V100
52
- .Trashes
53
- ehthumbs.db
54
  Thumbs.db
55
 
56
- # Docker
57
- Dockerfile
58
- .dockerignore
59
- docker-compose.yml
60
- docker-compose.yaml
61
-
62
- # Documentation
63
- README*.md
64
- DEPLOYMENT_GUIDE.md
65
- *.md
66
 
67
- # Deployment scripts
68
- deploy_to_spaces.py
69
- app_spaces.py
70
- requirements_spaces.txt
71
- README_spaces.md
72
 
73
- # Large files that shouldn't be in container
74
- *.pth
75
- *.bin
76
- *.safetensors
77
- *.ckpt
78
- *.h5
79
- *.hdf5
80
- *.pkl
81
- *.pickle
82
- *.joblib
83
- *.model
84
- *.weights
85
- *.pt
86
- *.onnx
87
- *.tflite
88
- *.pb
89
- *.savedmodel
90
- *.mar
91
- *.mlmodel
92
- *.mlpackage
93
- *.mlflow
94
- *.bundle
95
 
96
- # Archives
97
- *.zip
98
- *.tar.gz
99
- *.rar
100
- *.7z
101
- *.gz
102
- *.bz2
103
- *.xz
104
- *.lzma
105
- *.zst
106
- *.lz4
107
- *.br
108
 
109
  # Temporary files
110
  *.tmp
111
  *.temp
112
- temp/
113
- tmp/
 
 
 
 
 
 
1
  # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
  .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ *.egg-info/
20
+ .installed.cfg
21
+ *.egg
22
+
23
+ # Virtual environments
 
 
 
24
  .env
25
  .venv
26
  env/
 
38
 
39
  # OS
40
  .DS_Store
 
 
 
 
 
41
  Thumbs.db
42
 
43
+ # Git
44
+ .git/
45
+ .gitignore
 
 
 
 
 
 
 
46
 
47
+ # Jupyter
48
+ .ipynb_checkpoints/
 
 
 
49
 
50
+ # Models (if they're large)
51
+ models/*.pth
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
 
53
+ # Logs
54
+ *.log
 
 
 
 
 
 
 
 
 
 
55
 
56
  # Temporary files
57
  *.tmp
58
  *.temp
 
 
Dockerfile CHANGED
@@ -26,15 +26,28 @@ RUN apt-get update && apt-get install -y \
26
 
27
  # Copy requirements and install Python dependencies
28
  COPY requirements.txt .
 
 
 
 
 
 
29
  RUN pip install --no-cache-dir --upgrade pip setuptools wheel
 
 
 
30
  RUN pip install --no-cache-dir -r requirements.txt
31
 
32
  # Verify moviepy installation
33
  RUN python -c "import moviepy; print('MoviePy version:', moviepy.__version__)"
34
 
35
- # Copy the app
36
  COPY app.py .
37
  COPY simple_model_manager.py .
 
 
 
 
38
 
39
  # Expose port
40
  EXPOSE 7860
 
26
 
27
  # Copy requirements and install Python dependencies
28
  COPY requirements.txt .
29
+
30
+ # Set environment variables to prefer pre-built wheels
31
+ ENV PIP_PREFER_BINARY=1
32
+ ENV PIP_NO_BUILD_ISOLATION=0
33
+
34
+ # Upgrade pip and install numpy first (to avoid conflicts)
35
  RUN pip install --no-cache-dir --upgrade pip setuptools wheel
36
+ RUN pip install --no-cache-dir "numpy>=1.24.0,<2.0.0"
37
+
38
+ # Install the rest of the requirements
39
  RUN pip install --no-cache-dir -r requirements.txt
40
 
41
  # Verify moviepy installation
42
  RUN python -c "import moviepy; print('MoviePy version:', moviepy.__version__)"
43
 
44
+ # Copy the app and test script
45
  COPY app.py .
46
  COPY simple_model_manager.py .
47
+ COPY test_imports.py .
48
+
49
+ # Test all imports work correctly
50
+ RUN python test_imports.py
51
 
52
  # Expose port
53
  EXPOSE 7860
app.py CHANGED
@@ -358,7 +358,6 @@ def predict_audio_sentiment(audio_bytes):
358
 
359
  # Load and preprocess audio
360
  import librosa
361
- import io
362
  import tempfile
363
 
364
  # Save audio bytes to temporary file
 
358
 
359
  # Load and preprocess audio
360
  import librosa
 
361
  import tempfile
362
 
363
  # Save audio bytes to temporary file
pyproject.toml CHANGED
@@ -10,5 +10,5 @@ dependencies = [
10
  "moviepy>=2.2.1",
11
  "speechrecognition>=3.10.0",
12
  "streamlit-webrtc>=0.47.0",
13
- "opencv-python-headless>=4.12.0.88",
14
  ]
 
10
  "moviepy>=2.2.1",
11
  "speechrecognition>=3.10.0",
12
  "streamlit-webrtc>=0.47.0",
13
+ "opencv-python-headless>=4.8.0",
14
  ]
requirements.txt CHANGED
Binary files a/requirements.txt and b/requirements.txt differ
 
uv.lock CHANGED
@@ -1455,7 +1455,7 @@ dependencies = [
1455
  requires-dist = [
1456
  { name = "gdown", specifier = ">=5.2.0" },
1457
  { name = "moviepy", specifier = ">=2.2.1" },
1458
- { name = "opencv-python-headless", specifier = ">=4.12.0.88" },
1459
  { name = "python-dotenv", specifier = ">=1.1.1" },
1460
  { name = "speechrecognition", specifier = ">=3.10.0" },
1461
  { name = "streamlit-webrtc", specifier = ">=0.47.0" },
 
1455
  requires-dist = [
1456
  { name = "gdown", specifier = ">=5.2.0" },
1457
  { name = "moviepy", specifier = ">=2.2.1" },
1458
+ { name = "opencv-python-headless", specifier = ">=4.8.0" },
1459
  { name = "python-dotenv", specifier = ">=1.1.1" },
1460
  { name = "speechrecognition", specifier = ">=3.10.0" },
1461
  { name = "streamlit-webrtc", specifier = ">=0.47.0" },