arxivgpt kim commited on
Commit
2d07bd4
·
verified ·
1 Parent(s): d4fafe6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +36 -40
app.py CHANGED
@@ -207,63 +207,59 @@ footer {
207
  """
208
 
209
  with gr.Blocks(css=css) as demo:
210
-
211
-
212
- with gr.Row():
213
-
214
- with gr.Column():
215
- video_in = gr.Video(sources=["upload"], label="Video input")
216
- with gr.Row():
217
- chosen_model = gr.Dropdown(label="Choose a model", choices=["MAGNet", "AudioLDM-2", "AudioGen", "Tango"], value="Tango")
218
- submit_btn = gr.Button("Submit", scale=0)
219
- with gr.Column():
220
- caption_o = gr.Textbox(label="Scene caption", interactive=False)
221
- retry_btn = gr.Button("Retry with edited scene caption", interactive=False)
222
- audio_o = gr.Audio(label="Audio output")
223
  with gr.Column():
224
- video_o = gr.Video(label="Video with soundFX")
 
 
 
 
225
 
226
- gr.Examples(
227
- examples = [
228
- ["examples/photoreal-train.mp4", "Tango"],
229
- ["examples/train-window.mp4", "Tango"],
230
- ["examples/chinese-new-year-dragon.mp4", "Tango"],
231
- ["examples/big-sur.mp4", "AudioLDM-2"]
232
- ],
233
- fn=infer,
234
- inputs = [video_in, chosen_model],
235
- outputs= [caption_o, retry_btn, audio_o, video_o],
236
- #cache_examples=True
237
- )
238
 
239
  video_in.change(
240
- fn = refresh,
241
- inputs = None,
242
- outputs = [caption_o, retry_btn, audio_o, video_o],
243
- queue = False,
244
- show_progress = False
245
  )
246
 
247
  video_in.clear(
248
- fn = refresh,
249
- inputs = None,
250
- outputs = [caption_o, retry_btn, audio_o, video_o],
251
- queue = False,
252
- show_progress = False
253
  )
254
-
255
  submit_btn.click(
256
  fn=infer,
257
  inputs=[video_in, chosen_model],
258
  outputs=[caption_o, retry_btn, audio_o, video_o],
259
- concurrency_limit = 2
260
  )
261
 
262
  retry_btn.click(
263
  fn=retry,
264
  inputs=[caption_o, video_in, chosen_model],
265
  outputs=[audio_o, video_o],
266
- concurrency_limit = 2
267
  )
268
 
269
- demo.queue(max_size=10).launch(show_api=False, debug=True, show_error=True)
 
207
  """
208
 
209
  with gr.Blocks(css=css) as demo:
210
+ with gr.Row():
211
+ with gr.Column():
212
+ video_in = gr.Video(sources=["upload"], label="Video input")
213
+ with gr.Row():
214
+ chosen_model = gr.Dropdown(label="Choose a model", choices=["MAGNet", "AudioLDM-2", "AudioGen", "Tango"], value="Tango")
215
+ submit_btn = gr.Button("Submit", scale=0)
 
 
 
 
 
 
 
216
  with gr.Column():
217
+ caption_o = gr.Textbox(label="Scene caption", interactive=False)
218
+ retry_btn = gr.Button("Retry with edited scene caption", interactive=False)
219
+ audio_o = gr.Audio(label="Audio output")
220
+ with gr.Column():
221
+ video_o = gr.Video(label="Video with soundFX")
222
 
223
+ gr.Examples(
224
+ examples=[
225
+ ["examples/photoreal-train.mp4", "Tango"],
226
+ ["examples/train-window.mp4", "Tango"],
227
+ ["examples/chinese-new-year-dragon.mp4", "Tango"],
228
+ ["examples/big-sur.mp4", "AudioLDM-2"]
229
+ ],
230
+ fn=infer,
231
+ inputs=[video_in, chosen_model],
232
+ outputs=[caption_o, retry_btn, audio_o, video_o]
233
+ )
 
234
 
235
  video_in.change(
236
+ fn=refresh,
237
+ inputs=None,
238
+ outputs=[caption_o, retry_btn, audio_o, video_o],
239
+ queue=False,
240
+ show_progress=False
241
  )
242
 
243
  video_in.clear(
244
+ fn=refresh,
245
+ inputs=None,
246
+ outputs=[caption_o, retry_btn, audio_o, video_o],
247
+ queue=False,
248
+ show_progress=False
249
  )
250
+
251
  submit_btn.click(
252
  fn=infer,
253
  inputs=[video_in, chosen_model],
254
  outputs=[caption_o, retry_btn, audio_o, video_o],
255
+ concurrency_limit=2
256
  )
257
 
258
  retry_btn.click(
259
  fn=retry,
260
  inputs=[caption_o, video_in, chosen_model],
261
  outputs=[audio_o, video_o],
262
+ concurrency_limit=2
263
  )
264
 
265
+ demo.queue(max_size=10).launch(show_api=False, debug=True, show_error=True)