Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,26 +1,42 @@
|
|
|
|
|
|
|
|
| 1 |
import sys
|
| 2 |
|
|
|
|
| 3 |
print("Python executable:", sys.executable)
|
| 4 |
print("Python version:", sys.version)
|
| 5 |
-
print("sys.path:")
|
| 6 |
-
for p in sys.path:
|
| 7 |
-
print(" ", p)
|
| 8 |
|
| 9 |
try:
|
| 10 |
import moviepy
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
except Exception as e:
|
| 13 |
print("Failed to import moviepy:", e)
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
import whisper
|
| 17 |
from moviepy.editor import VideoFileClip
|
| 18 |
from transformers import pipeline
|
| 19 |
import nltk
|
| 20 |
-
import os
|
| 21 |
import re
|
| 22 |
import random
|
| 23 |
-
import subprocess
|
| 24 |
from sklearn.feature_extraction.text import TfidfVectorizer
|
| 25 |
from sklearn.metrics.pairwise import cosine_similarity
|
| 26 |
from nltk.tokenize import sent_tokenize
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import subprocess
|
| 3 |
import sys
|
| 4 |
|
| 5 |
+
# Print Python environment info (optional, for logs)
|
| 6 |
print("Python executable:", sys.executable)
|
| 7 |
print("Python version:", sys.version)
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
try:
|
| 10 |
import moviepy
|
| 11 |
+
moviepy_path = os.path.dirname(moviepy.__file__)
|
| 12 |
+
print("moviepy path:", moviepy_path)
|
| 13 |
+
|
| 14 |
+
editor_path = os.path.join(moviepy_path, "editor.py")
|
| 15 |
+
editor_folder_path = os.path.join(moviepy_path, "editor")
|
| 16 |
+
|
| 17 |
+
print("moviepy/editor.py exists:", os.path.isfile(editor_path))
|
| 18 |
+
print("moviepy/editor/ folder exists:", os.path.isdir(editor_folder_path))
|
| 19 |
+
|
| 20 |
except Exception as e:
|
| 21 |
print("Failed to import moviepy:", e)
|
| 22 |
|
| 23 |
+
# Force reinstall moviepy to fix possible incomplete install
|
| 24 |
+
try:
|
| 25 |
+
subprocess.check_call([sys.executable, "-m", "pip", "install", "--force-reinstall", "moviepy==2.2.1"])
|
| 26 |
+
print("moviepy reinstalled successfully.")
|
| 27 |
+
except Exception as e:
|
| 28 |
+
print("Failed to reinstall moviepy:", e)
|
| 29 |
+
|
| 30 |
+
|
| 31 |
|
| 32 |
import whisper
|
| 33 |
from moviepy.editor import VideoFileClip
|
| 34 |
from transformers import pipeline
|
| 35 |
import nltk
|
| 36 |
+
#import os
|
| 37 |
import re
|
| 38 |
import random
|
| 39 |
+
#import subprocess
|
| 40 |
from sklearn.feature_extraction.text import TfidfVectorizer
|
| 41 |
from sklearn.metrics.pairwise import cosine_similarity
|
| 42 |
from nltk.tokenize import sent_tokenize
|