ziqiangao commited on
Commit
433ba4d
·
verified ·
1 Parent(s): ab914b1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -29
app.py CHANGED
@@ -288,41 +288,38 @@ def gradio_interface(audio_file, lyrics, output_name, fps=30, vidwidth=1280, vid
288
  srt_output = "out.srt" if haslyrics else None
289
  return video_file, srt_output
290
 
291
- def update_srt_output_visibility(haslyrics):
 
292
  return gr.update(visible=haslyrics)
293
 
294
  with gr.Blocks() as demo:
295
  gr.Markdown('Upload an MP3 file and configure parameters to create a visualization video.\nOptionally upload a word or line synced lyric file\nEnsure a blank line at the end to avoid conversion errors')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
296
 
297
- with gr.Row():
298
- with gr.Column():
299
- gr.Markdown('# Audio Settings')
300
- audio_file = gr.File(label="Upload your MP3 file", file_count='single', file_types=['mp3'])
301
- lyrics_file = gr.File(label="(Optional) Upload Lyrics as LRC or SRT", file_count='single', file_types=['lrc', 'srt'])
302
-
303
- with gr.Column():
304
- gr.Markdown('# Video Output Settings')
305
- output_name = gr.Textbox(label="Output Video Name", value='video')
306
- fps_slider = gr.Slider(label="Frames per Second", minimum=20, maximum=60, step=1, value=30)
307
- vidwidth_slider = gr.Slider(label="Output Video Width", minimum=100, maximum=2000, value=1280, step=2)
308
- vidheight_slider = gr.Slider(label="Output Video Height", minimum=100, maximum=2000, value=720, step=2)
309
-
310
- with gr.Row():
311
- with gr.Column():
312
- gr.Markdown('# Advanced Options')
313
- oscres_slider = gr.Slider(label="Number of Visualization Segments", minimum=256, maximum=2048, step=2, value=512)
314
-
315
- with gr.Column():
316
- gr.Markdown('# Mp3 Metadata')
317
- cover_img = gr.Image(label='Cover Art')
318
- title_input = gr.Textbox(label='Title')
319
- artist_input = gr.Textbox(label='Artists')
320
-
321
- with gr.Row():
322
- output_video = gr.Video(label="Output")
323
- srt_output = gr.File(label="SRT Output", visible=False)
324
 
325
- # Connect the inputs to the function
326
  demo.load(
327
  fn=gradio_interface,
328
  inputs=[audio_file, lyrics_file, output_name, fps_slider, vidwidth_slider, vidheight_slider, oscres_slider, cover_img, title_input, artist_input],
 
288
  srt_output = "out.srt" if haslyrics else None
289
  return video_file, srt_output
290
 
291
+ def update_srt_output_visibility(lyrics):
292
+ haslyrics = lyrics is not None
293
  return gr.update(visible=haslyrics)
294
 
295
  with gr.Blocks() as demo:
296
  gr.Markdown('Upload an MP3 file and configure parameters to create a visualization video.\nOptionally upload a word or line synced lyric file\nEnsure a blank line at the end to avoid conversion errors')
297
+
298
+ with gr.Accordion(label="Audio Settings", open=True):
299
+ gr.Markdown('# Load your mp3 and lyrics file here')
300
+ audio_file = gr.File(label="Upload your MP3 file", file_count='single', file_types=['mp3'])
301
+ lyrics_file = gr.File(label="(Optional) Upload Lyrics as LRC or SRT", file_count='single', file_types=['lrc', 'srt'])
302
+
303
+ with gr.Accordion(label="Video Output Settings"):
304
+ gr.Markdown('# Configure Video Output Here')
305
+ output_name = gr.Textbox(label="Output Video Name", value='video')
306
+ fps_slider = gr.Slider(label="Frames per Second", minimum=20, maximum=60, step=1, value=30)
307
+ vidwidth_slider = gr.Slider(label="Output Video Width", minimum=100, maximum=2000, value=1280, step=2)
308
+ vidheight_slider = gr.Slider(label="Output Video Height", minimum=100, maximum=2000, value=720, step=2)
309
+
310
+ with gr.Accordion(label="Advanced Options"):
311
+ oscres_slider = gr.Slider(label="Number of Visualization Segments", minimum=256, maximum=2048, step=2, value=512)
312
+
313
+ with gr.Accordion(label="Mp3 Metadata"):
314
+ gr.Markdown('# Add Metadata here if your mp3 does not have one')
315
+ cover_img = gr.Image(label='Cover Art')
316
+ title_input = gr.Textbox(label='Title')
317
+ artist_input = gr.Textbox(label='Artists')
318
 
319
+ output_video = gr.Video(label="Output")
320
+ srt_output = gr.File(label="SRT Output", visible=False)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
321
 
322
+ # Connect the main function
323
  demo.load(
324
  fn=gradio_interface,
325
  inputs=[audio_file, lyrics_file, output_name, fps_slider, vidwidth_slider, vidheight_slider, oscres_slider, cover_img, title_input, artist_input],