Surn commited on
Commit
a549dc4
1 Parent(s): d758673

Bug fix melody_filepath

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -96,8 +96,8 @@ def load_melody_filepath(melody_filepath, title):
96
  # get melody filename
97
  #$Union[str, os.PathLike]
98
  symbols = ['_', '.', '-']
99
- if melody_filepath is None:
100
- return None, title, gr.Slider.update(maximum=0, value=0) , gr.Radio.update(value="melody", interactive=True)
101
 
102
  if (title is None) or ("MusicGen" in title) or (title == ""):
103
  melody_name, melody_extension = get_filename_from_filepath(melody_filepath)
@@ -340,7 +340,7 @@ def ui(**kwargs):
340
  seed_used = gr.Number(label='Seed used', value=-1, interactive=False)
341
 
342
  radio.change(toggle_audio_src, radio, [melody_filepath], queue=False, show_progress=False)
343
- melody_filepath.change(load_melody_filepath, inputs=[melody_filepath, title], outputs=[title, prompt_index , model], api_name="melody_filepath_change")
344
  reuse_seed.click(fn=lambda x: x, inputs=[seed_used], outputs=[seed], queue=False, api_name="reuse_seed")
345
  submit.click(predict, inputs=[model, text,melody_filepath, duration, dimension, topk, topp, temperature, cfg_coef, background, title, settings_font, settings_font_color, seed, overlap, prompt_index, include_title, include_settings, harmony_only], outputs=[output, wave_file, seed_used], api_name="submit")
346
  gr.Examples(
 
96
  # get melody filename
97
  #$Union[str, os.PathLike]
98
  symbols = ['_', '.', '-']
99
+ if (melody_filepath is None) or (melody_filepath == ""):
100
+ return title, gr.Slider.update(maximum=0, value=0) , gr.Radio.update(value="melody", interactive=True)
101
 
102
  if (title is None) or ("MusicGen" in title) or (title == ""):
103
  melody_name, melody_extension = get_filename_from_filepath(melody_filepath)
 
340
  seed_used = gr.Number(label='Seed used', value=-1, interactive=False)
341
 
342
  radio.change(toggle_audio_src, radio, [melody_filepath], queue=False, show_progress=False)
343
+ melody_filepath.change(load_melody_filepath, inputs=[melody_filepath, title], outputs=[title, prompt_index , model], api_name="melody_filepath_change")
344
  reuse_seed.click(fn=lambda x: x, inputs=[seed_used], outputs=[seed], queue=False, api_name="reuse_seed")
345
  submit.click(predict, inputs=[model, text,melody_filepath, duration, dimension, topk, topp, temperature, cfg_coef, background, title, settings_font, settings_font_color, seed, overlap, prompt_index, include_title, include_settings, harmony_only], outputs=[output, wave_file, seed_used], api_name="submit")
346
  gr.Examples(