arxivgpt kim commited on
Commit
144ba4f
·
verified ·
1 Parent(s): 230e2bf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -51
app.py CHANGED
@@ -343,98 +343,73 @@ div#component-11 > .gallery > .gallery-item > .container > img {
343
  }
344
  """
345
 
346
-
347
-
348
  with gr.Blocks(css=css) as demo:
349
 
350
  with gr.Column(elem_id="col-container"):
351
 
352
  gr.HTML(f"""
353
- <h2 style="text-align: center;">{demo_title}</h2>
354
- <p style="text-align: center;">{description}</p>
355
  """)
356
 
357
  with gr.Row():
358
 
359
  with gr.Column():
360
- video_in = gr.Video(sources=["upload"], label="Video input")
361
 
362
  with gr.Row():
363
 
364
  chosen_model = gr.Dropdown(
365
- label = "Choose a model",
366
- choices = [
367
  "MAGNet",
368
  "AudioLDM-2",
369
  "Riffusion",
370
  "Mustango",
371
  "MusicGen"
372
  ],
373
- value = None,
374
- filterable = False
375
  )
376
 
377
  check_status = gr.Textbox(
378
- label="API status",
379
  interactive=False
380
  )
381
 
382
- submit_btn = gr.Button("Make music from my shot !")
383
-
384
- gr.Examples(
385
- examples = [
386
- "vid_examples/big-sur.mp4",
387
- "vid_examples/snow-dogs.mp4",
388
- "vid_examples/ocean-turtle.mp4"
389
- ],
390
- inputs = [video_in],
391
- cache_examples=False
392
- )
393
 
394
  with gr.Column():
395
 
396
  caption = gr.Textbox(
397
- label = "Inspirational musical prompt",
398
- interactive = False,
399
- elem_id = "inspi-prompt"
400
  )
401
 
402
- retry_btn = gr.Button("Retry with edited prompt", visible=False)
403
 
404
- result = gr.Audio(
405
- label = "Music"
406
- )
407
-
408
- video_o = gr.Video(label="Video with soundFX")
409
 
410
-
411
  chosen_model.change(
412
- fn = check_api,
413
- inputs = chosen_model,
414
- outputs = check_status,
415
- queue = False
416
  )
417
 
418
  retry_btn.click(
419
- fn = retry,
420
- inputs = [video_in, chosen_model, caption],
421
- outputs = [result, video_o]
422
  )
423
 
424
  submit_btn.click(
425
- fn = infer,
426
- inputs = [
427
- video_in,
428
- chosen_model,
429
- check_status
430
- ],
431
- outputs =[
432
- caption,
433
- retry_btn,
434
- result,
435
- video_o
436
- ],
437
- concurrency_limit = 4
438
  )
439
 
440
  demo.queue(max_size=16).launch(show_api=False)
 
343
  }
344
  """
345
 
 
 
346
  with gr.Blocks(css=css) as demo:
347
 
348
  with gr.Column(elem_id="col-container"):
349
 
350
  gr.HTML(f"""
351
+ <h2 style="text-align: center;">Music Generation Demo</h2>
352
+ <p style="text-align: center;">Extracts an image from a video to generate a description and creates music based on it.</p>
353
  """)
354
 
355
  with gr.Row():
356
 
357
  with gr.Column():
358
+ video_in = gr.Video(sources=["upload"], label="Video Input")
359
 
360
  with gr.Row():
361
 
362
  chosen_model = gr.Dropdown(
363
+ label="Choose a Model",
364
+ choices=[
365
  "MAGNet",
366
  "AudioLDM-2",
367
  "Riffusion",
368
  "Mustango",
369
  "MusicGen"
370
  ],
371
+ value=None,
372
+ filterable=False
373
  )
374
 
375
  check_status = gr.Textbox(
376
+ label="API Status",
377
  interactive=False
378
  )
379
 
380
+ submit_btn = gr.Button("Generate Music")
 
 
 
 
 
 
 
 
 
 
381
 
382
  with gr.Column():
383
 
384
  caption = gr.Textbox(
385
+ label="Inspirational Musical Prompt",
386
+ interactive=False,
387
+ elem_id="inspi-prompt"
388
  )
389
 
390
+ retry_btn = gr.Button("Retry with Edited Prompt", visible=False)
391
 
392
+ result = gr.Audio(label="Music")
393
+ video_o = gr.Video(label="Video with SoundFX")
 
 
 
394
 
 
395
  chosen_model.change(
396
+ fn=check_api,
397
+ inputs=chosen_model,
398
+ outputs=check_status,
399
+ queue=False
400
  )
401
 
402
  retry_btn.click(
403
+ fn=retry,
404
+ inputs=[video_in, chosen_model, caption],
405
+ outputs=[result, video_o]
406
  )
407
 
408
  submit_btn.click(
409
+ fn=infer,
410
+ inputs=[video_in, chosen_model, check_status],
411
+ outputs=[caption, retry_btn, result, video_o],
412
+ concurrency_limit=4
 
 
 
 
 
 
 
 
 
413
  )
414
 
415
  demo.queue(max_size=16).launch(show_api=False)