ziqiangao commited on
Commit
d940837
·
1 Parent(s): 0f5d5d5

update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -38
app.py CHANGED
@@ -291,49 +291,31 @@ def gradio_interface(audio_file, lyrics, output_name, fps=30, vidwidth=1280, vid
291
  shutil.rmtree("out")
292
  return f"{output_name}.mp4"
293
 
294
- # Define Gradio interface with accordions
295
- inputs = [
296
- gr.Accordion(
297
- label="Audio Settings",
298
- items=[
299
- gr.components.File(label="Upload your MP3 file", file_count='single', file_types=['mp3']),
300
- gr.components.File(label="(Optional) Upload Lyrics as LRC or SRT", file_count='single', file_types=['lrc','srt'])
301
- ],
302
- open=True
303
- ),
304
- gr.Accordion(
305
- label="Video Output Settings",
306
- items=[
307
- gr.components.Textbox(label="Output Video Name", value='video'),
308
- gr.components.Slider(label="Frames per Second", minimum=20, maximum=60, step=1, value=30),
309
- gr.components.Slider(label="Output Video Width", minimum=100, maximum=2000, value=1280, step=2),
310
- gr.components.Slider(label="Output Video Height", minimum=100, maximum=2000, value=720, step=2)
311
- ]
312
- ),
313
- gr.Accordion(
314
- title="Advanced Options",
315
- items=[
316
- gr.components.Slider(label="Number of Visualization Segments", minimum=256, maximum=2048, step=2, value=512),
317
- ]
318
- ),
319
- gr.Accordion(
320
- title="Mp3 Metadata (Use if mp3 does not have tags)",
321
- items=[
322
- gr.components.Image(label='Cover Art'),
323
- gr.components.Textbox(label='Title'),
324
- gr.components.Textbox(label='Artists')
325
- ]
326
- )
327
- ]
328
 
329
  iface = gr.Interface(
330
  fn=gradio_interface,
331
  inputs=inputs,
332
  outputs=gr.components.Video(label="Output"),
333
- title="MP3 to Video Visualization",
334
- description=""" Upload an MP3 file and configure parameters to create a visualization video.
335
- Optionally upload a word or line synced lyric file
336
- Ensure a blank line at the end to avoid conversion errors"""
337
  )
338
 
339
  # Launch Gradio interface
 
291
  shutil.rmtree("out")
292
  return f"{output_name}.mp4"
293
 
294
+ with gr.Blocks() as inputs:
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
+ with gr.Accordion(label="Audio Settings", open=True):
297
+ gr.Markdown('#Load your mp3 and lyrics file here')
298
+ gr.components.File(label="Upload your MP3 file", file_count='single', file_types=['mp3']),
299
+ gr.components.File(label="(Optional) Upload Lyrics as LRC or SRT", file_count='single', file_types=['lrc','srt']),
300
+
301
+ with gr.Accordion(label="Video Output Settings"):
302
+ gr.Markdown('#Configure Video Output Here')
303
+ gr.components.Textbox(label="Output Video Name", value='video'),
304
+ gr.components.Slider(label="Frames per Second", minimum=20, maximum=60, step=1, value=30),
305
+ gr.components.Slider(label="Output Video Width", minimum=100, maximum=2000, value=1280, step=2),
306
+ gr.components.Slider(label="Output Video Height", minimum=100, maximum=2000, value=720, step=2)
307
+ with gr.Accordion(title="Advanced Options"):
308
+ gr.components.Slider(label="Number of Visualization Segments", minimum=256, maximum=2048, step=2, value=512),
309
+ with gr.Accordion(title="Mp3 Metadata"):
310
+ gr.Markdown('#Add Metadata here if your mp3 does not have one')
311
+ gr.components.Image(label='Cover Art'),
312
+ gr.components.Textbox(label='Title'),
313
+ gr.components.Textbox(label='Artists')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
314
 
315
  iface = gr.Interface(
316
  fn=gradio_interface,
317
  inputs=inputs,
318
  outputs=gr.components.Video(label="Output"),
 
 
 
 
319
  )
320
 
321
  # Launch Gradio interface