Jeffgold commited on
Commit
639e395
·
1 Parent(s): 3086083

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -7,6 +7,7 @@ from threading import Thread
7
  from pathlib import Path
8
  from moviepy.editor import VideoFileClip
9
  import gradio as gr
 
10
 
11
  # Initialize a Flask application
12
  app = Flask(__name__)
@@ -109,21 +110,20 @@ def convert_video(video_file, quality, aspect_ratio, video_url):
109
  '''
110
  html_blocks.append(video_component)
111
 
112
- return "\n".join(html_blocks),
113
 
114
- video_file = gr.inputs.File(label="Video File")
115
- quality = gr.inputs.Dropdown(choices=["18", "23", "27", "28", "32"], default="27", label="Quality")
116
- aspect_ratio = gr.inputs.Dropdown(choices=["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"], default="16:9", label="Aspect ratio (width:height)")
117
- standard_resolutions = [4320, 2160, 1440, 1080, 720, 480, 360, 240, 144] # 8K, 4K, 2K, Full HD, HD, SD in pixels
118
- video_url = gr.inputs.Textbox(label="Or enter video URL")
119
 
120
  interface = gr.Interface(
121
  fn=convert_video,
122
  inputs=[video_file, quality, aspect_ratio, video_url],
123
- outputs=[gr.outputs.HTML(label="Download Links")],
124
  title="Video Converter",
125
  description="A simple video converter app",
126
- allow_flagging=False
127
  )
128
 
129
  interface.launch(server_name="0.0.0.0", server_port=7860)
 
7
  from pathlib import Path
8
  from moviepy.editor import VideoFileClip
9
  import gradio as gr
10
+ from gradio import components
11
 
12
  # Initialize a Flask application
13
  app = Flask(__name__)
 
110
  '''
111
  html_blocks.append(video_component)
112
 
113
+ return html_string
114
 
115
+ video_file = components.File(type="video", label="Your video file")
116
+ quality = components.Radio(["Low", "Medium", "High"], label="Quality", default="High")
117
+ aspect_ratio = components.Radio(["16:9", "4:3", "1:1"], label="Aspect Ratio", default="16:9")
118
+ video_url = components.Textbox(placeholder="or paste video url here", label="Video URL")
 
119
 
120
  interface = gr.Interface(
121
  fn=convert_video,
122
  inputs=[video_file, quality, aspect_ratio, video_url],
123
+ outputs=[components.HTML(label="Download Links")],
124
  title="Video Converter",
125
  description="A simple video converter app",
126
+ allow_flagging='False'
127
  )
128
 
129
  interface.launch(server_name="0.0.0.0", server_port=7860)