hivecorp commited on
Commit
0692426
·
verified ·
1 Parent(s): ab9165c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -34,7 +34,11 @@ def text_to_video(text, voice, rate, pitch, bg_media, video_width, video_height)
34
  return None, warning
35
 
36
  audio_clip = AudioFileClip(audio)
37
-
 
 
 
 
38
  # Create background video or image
39
  if bg_media.endswith('.mp4'):
40
  bg_clip = VideoFileClip(bg_media).resize(newsize=(video_width, video_height)).set_duration(audio_clip.duration)
@@ -85,4 +89,4 @@ async def create_demo():
85
  # Run the application
86
  if __name__ == "__main__":
87
  demo = asyncio.run(create_demo())
88
- demo.launch()
 
34
  return None, warning
35
 
36
  audio_clip = AudioFileClip(audio)
37
+
38
+ # Check if bg_media is None
39
+ if bg_media is None:
40
+ return None, gr.Warning("Please upload a background image or video.")
41
+
42
  # Create background video or image
43
  if bg_media.endswith('.mp4'):
44
  bg_clip = VideoFileClip(bg_media).resize(newsize=(video_width, video_height)).set_duration(audio_clip.duration)
 
89
  # Run the application
90
  if __name__ == "__main__":
91
  demo = asyncio.run(create_demo())
92
+ demo.launch(share=True) # Set share=True for public link