Jeffgold commited on
Commit
0e31770
·
1 Parent(s): 6d80bec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -153,12 +153,14 @@ def convert_video(video_file, quality, aspect_ratio, video_url):
153
  output_paths.append(master_playlist_path)
154
 
155
  # Convert Path objects to URLs before returning
156
- return [{'name': path.stem, 'url': f"http://localhost:{PORT}/{path.name}"} for path in output_paths]
 
157
 
158
  video_file = gr.File(label="Video File")
159
  quality = gr.Dropdown(
160
- choices=["18", "23", "27", "28", "32"], label="Quality", default="27")
161
- aspect_ratio = gr.Textbox(default="16:9", lines=1, label="Aspect ratio (width:height)")
 
162
  standard_resolutions = [4320, 2160, 1440, 1080, 720, 480, 360, 240, 144] # 8K, 4K, 2K, Full HD, HD, SD in pixels
163
  video_url = gr.Textbox(label="Or enter video URL")
164
 
@@ -171,7 +173,7 @@ def format_output(output):
171
  interface = gr.Interface(
172
  fn=convert_video,
173
  inputs=[video_file, quality, aspect_ratio, video_url],
174
- outputs=gr.outputs.HTML(label="Download Links", postprocess=format_output),
175
  title="Video Converter",
176
  description="A simple video converter app",
177
  allow_flagging=False,
 
153
  output_paths.append(master_playlist_path)
154
 
155
  # Convert Path objects to URLs before returning
156
+ return format_output([{'name': path.stem, 'url': f"http://localhost:{PORT}/{path.name}"} for path in output_paths])
157
+
158
 
159
  video_file = gr.File(label="Video File")
160
  quality = gr.Dropdown(
161
+ "27", ["18", "23", "27", "28", "32"], label="Quality")
162
+ aspect_ratio = gr.Dropdown("16:9", ["16:9", "1:1", "4:3", "3:2", "5:4", "21:9", "1.85:1", "2.35:1", "3:1", "360", "9:16", "2:1", "1:2", "9:1"],
163
+ label="Aspect ratio (width:height)")
164
  standard_resolutions = [4320, 2160, 1440, 1080, 720, 480, 360, 240, 144] # 8K, 4K, 2K, Full HD, HD, SD in pixels
165
  video_url = gr.Textbox(label="Or enter video URL")
166
 
 
173
  interface = gr.Interface(
174
  fn=convert_video,
175
  inputs=[video_file, quality, aspect_ratio, video_url],
176
+ outputs=gr.outputs.HTML(label="Download Links"),
177
  title="Video Converter",
178
  description="A simple video converter app",
179
  allow_flagging=False,