TIMBOVILL commited on
Commit
4d660a6
·
verified ·
1 Parent(s): c937835

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -14,6 +14,7 @@ def install_imagemagick():
14
 
15
  install_imagemagick()
16
 
 
17
  import os
18
  from moviepy.editor import VideoFileClip, CompositeVideoClip, ImageClip
19
  from PIL import Image, ImageDraw, ImageFont
@@ -27,7 +28,9 @@ def create_text_clip(text, fontsize=70, color='white', size=(1080, 1920)):
27
  return img
28
 
29
  def process_video(video_file, text):
30
- video_path = video_file.name
 
 
31
  if not os.path.isfile(video_path):
32
  raise FileNotFoundError(f"The file {video_path} does not exist.")
33
 
 
14
 
15
  install_imagemagick()
16
 
17
+ import gradio as gr
18
  import os
19
  from moviepy.editor import VideoFileClip, CompositeVideoClip, ImageClip
20
  from PIL import Image, ImageDraw, ImageFont
 
28
  return img
29
 
30
  def process_video(video_file, text):
31
+ # Convert video_file string path to a file object and then extract the path
32
+ video_path = video_file.name if isinstance(video_file, gr.inputs.File) else video_file
33
+
34
  if not os.path.isfile(video_path):
35
  raise FileNotFoundError(f"The file {video_path} does not exist.")
36