Ahmadkhan12 commited on
Commit
60b0c3a
·
verified ·
1 Parent(s): eb44251

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -11
app.py CHANGED
@@ -1,25 +1,27 @@
1
  import os
2
- import sys
3
  import subprocess
 
 
 
 
 
 
 
 
 
 
4
 
5
- # Check if moviepy is installed; if not, install it
6
  try:
7
  from moviepy.editor import VideoFileClip, AudioFileClip
8
  except ImportError:
9
  print("MoviePy not found, attempting to install...")
10
  subprocess.check_call([sys.executable, "-m", "pip", "install", "moviepy"])
11
- # Retry importing after installation
12
- try:
13
- from moviepy.editor import VideoFileClip, AudioFileClip
14
- except ImportError:
15
- print("Failed to install moviepy.")
16
- sys.exit(1)
17
-
18
- import tempfile
19
- import gradio as gr
20
 
21
  # Hugging Face repo path (update with your repo details)
22
  MUSIC_DIR = "/mnt/data/chunks" # Modify this if necessary
 
23
  DEFAULT_MUSIC = "/mnt/data/default_music.mp3" # Path to default music if needed
24
 
25
  def load_music_files():
 
1
  import os
 
2
  import subprocess
3
+ import sys
4
+
5
+ # Diagnostic: Print Python version and executable path
6
+ print("Python version:", sys.version)
7
+ print("Python executable:", sys.executable)
8
+
9
+ # Diagnostic: List installed packages to confirm if moviepy is installed
10
+ installed_packages = subprocess.check_output([sys.executable, "-m", "pip", "freeze"]).decode("utf-8")
11
+ print("Installed packages:")
12
+ print(installed_packages)
13
 
14
+ # Try importing moviepy, force install if not found
15
  try:
16
  from moviepy.editor import VideoFileClip, AudioFileClip
17
  except ImportError:
18
  print("MoviePy not found, attempting to install...")
19
  subprocess.check_call([sys.executable, "-m", "pip", "install", "moviepy"])
20
+ from moviepy.editor import VideoFileClip, AudioFileClip
 
 
 
 
 
 
 
 
21
 
22
  # Hugging Face repo path (update with your repo details)
23
  MUSIC_DIR = "/mnt/data/chunks" # Modify this if necessary
24
+
25
  DEFAULT_MUSIC = "/mnt/data/default_music.mp3" # Path to default music if needed
26
 
27
  def load_music_files():