Jeffgold commited on
Commit
892b3a2
·
1 Parent(s): 9a8cb78

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -15,7 +15,7 @@ quality = gr.inputs.Dropdown(choices=["18", "23", "28", "32"], label="Quality",
15
  aspect_ratio = gr.inputs.Dropdown(choices=["16:9", "4:3", "3:2", "2:1"], label="Aspect Ratio", default="16:9")
16
 
17
  def convert_video(video_file: File, quality, aspect_ratio):
18
- output_path = f"{video_file.stem}.m3u8"
19
 
20
  temp_dir = tempfile.gettempdir()
21
  ffmpeg_command = f"ffmpeg -i {video_file} -c:v libx264 -crf {quality} -f hls -aspect {aspect_ratio} {temp_dir}/{output_path}"
@@ -23,4 +23,4 @@ def convert_video(video_file: File, quality, aspect_ratio):
23
 
24
  return components.Video(output_path)
25
 
26
- gr.Interface(convert_video, inputs=[video_file, quality, aspect_ratio], outputs=[components.Video()]).launch()
 
15
  aspect_ratio = gr.inputs.Dropdown(choices=["16:9", "4:3", "3:2", "2:1"], label="Aspect Ratio", default="16:9")
16
 
17
  def convert_video(video_file: File, quality, aspect_ratio):
18
+ output_path = f"{video_file.name.split('.')[0]}.m3u8"
19
 
20
  temp_dir = tempfile.gettempdir()
21
  ffmpeg_command = f"ffmpeg -i {video_file} -c:v libx264 -crf {quality} -f hls -aspect {aspect_ratio} {temp_dir}/{output_path}"
 
23
 
24
  return components.Video(output_path)
25
 
26
+ gr.Interface(convert_video, inputs=[video_file, quality, aspect_ratio], outputs=[components.Video()]).launch(share=True)