Avi3738 commited on
Commit
d44a3e7
·
verified ·
1 Parent(s): a5ebbe7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -8,14 +8,16 @@ if parse_version(Image.__version__) >= parse_version('10.0.0'):
8
  import gradio as gr
9
  from moviepy.editor import *
10
 
11
- def process_video(video_path, logo_path, outro_path, logo_position, logo_size):
12
  # Load the video, logo, and outro
13
  main_video = VideoFileClip(video_path)
 
 
14
  logo = (ImageClip(logo_path)
15
  .set_duration(main_video.duration)
16
  .resize(height=int(logo_size))
17
- .margin(right=8, top=8, opacity=0)
18
- .set_pos((logo_position)))
19
 
20
  outro_video = VideoFileClip(outro_path)
21
 
@@ -39,7 +41,6 @@ with gr.Blocks() as demo:
39
  video_input = gr.Video(label="Upload Your Video")
40
  logo_input = gr.Image(label="Upload Your Logo", type="filepath")
41
  outro_input = gr.Video(label="Upload Your Outro")
42
- logo_position = gr.Dropdown(label="Logo Position", choices=["left", "center", "right"], value="right")
43
  logo_size = gr.Slider(label="Logo Size", minimum=50, maximum=500, step=10, value=100)
44
  process_button = gr.Button("Process Video")
45
  with gr.Column():
@@ -47,7 +48,7 @@ with gr.Blocks() as demo:
47
 
48
  process_button.click(
49
  fn=process_video,
50
- inputs=[video_input, logo_input, outro_input, logo_position, logo_size],
51
  outputs=video_output
52
  )
53
 
 
8
  import gradio as gr
9
  from moviepy.editor import *
10
 
11
+ def process_video(video_path, logo_path, outro_path, logo_size):
12
  # Load the video, logo, and outro
13
  main_video = VideoFileClip(video_path)
14
+
15
+ # Position the logo in the bottom right corner
16
  logo = (ImageClip(logo_path)
17
  .set_duration(main_video.duration)
18
  .resize(height=int(logo_size))
19
+ .margin(right=8, bottom=8, opacity=0)
20
+ .set_pos(("right", "bottom")))
21
 
22
  outro_video = VideoFileClip(outro_path)
23
 
 
41
  video_input = gr.Video(label="Upload Your Video")
42
  logo_input = gr.Image(label="Upload Your Logo", type="filepath")
43
  outro_input = gr.Video(label="Upload Your Outro")
 
44
  logo_size = gr.Slider(label="Logo Size", minimum=50, maximum=500, step=10, value=100)
45
  process_button = gr.Button("Process Video")
46
  with gr.Column():
 
48
 
49
  process_button.click(
50
  fn=process_video,
51
+ inputs=[video_input, logo_input, outro_input, logo_size],
52
  outputs=video_output
53
  )
54