Ahmadkhan12 commited on
Commit
c7810b4
·
verified ·
1 Parent(s): 1a6da52

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -7
app.py CHANGED
@@ -1,21 +1,18 @@
 
 
1
 
 
 
2
  from moviepy.editor import VideoFileClip, AudioFileClip
3
  except ImportError:
4
- import os
5
  os.system("pip install moviepy")
6
  from moviepy.editor import VideoFileClip, AudioFileClip
7
 
8
-
9
-
10
- import os
11
- from random import choice
12
- from moviepy.editor import VideoFileClip, AudioFileClip
13
  import tempfile
14
  import gradio as gr
15
 
16
  # Hugging Face repo path (update with your repo details)
17
  MUSIC_DIR = "/mnt/data/chunks" # Modify this if necessary
18
-
19
  DEFAULT_MUSIC = "/mnt/data/default_music.mp3" # Path to default music if needed
20
 
21
  def load_music_files():
 
1
+ import os
2
+ from random import choice
3
 
4
+ # Try to import moviepy; if it fails, install it first
5
+ try:
6
  from moviepy.editor import VideoFileClip, AudioFileClip
7
  except ImportError:
 
8
  os.system("pip install moviepy")
9
  from moviepy.editor import VideoFileClip, AudioFileClip
10
 
 
 
 
 
 
11
  import tempfile
12
  import gradio as gr
13
 
14
  # Hugging Face repo path (update with your repo details)
15
  MUSIC_DIR = "/mnt/data/chunks" # Modify this if necessary
 
16
  DEFAULT_MUSIC = "/mnt/data/default_music.mp3" # Path to default music if needed
17
 
18
  def load_music_files():