keshavbhandari commited on
Commit
75c2013
1 Parent(s): c7f9825

Update max_length in generate_midi function

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -31,7 +31,7 @@ def save_wav(filepath):
31
  return wav_filepath
32
 
33
 
34
- def generate_midi(caption, temperature=0.9, max_len=1000):
35
  device = 'cuda' if torch.cuda.is_available() else 'cpu'
36
  artifact_folder = 'artifacts'
37
 
@@ -60,7 +60,7 @@ def generate_midi(caption, temperature=0.9, max_len=1000):
60
  generated_midi = r_tokenizer.decode(output_list)
61
  generated_midi.dump_midi("output.mid")
62
 
63
- @spaces.GPU(duration=300)
64
  def gradio_generate(prompt, temperature, max_length):
65
  # Generate midi
66
  generate_midi(prompt, temperature, max_length)
@@ -88,7 +88,7 @@ Generate midi music using Text2midi by providing a text prompt.
88
  input_text = gr.Textbox(lines=2, label="Prompt")
89
  output_audio = gr.Audio(label="Generated Music", type="filepath")
90
  temperature = gr.Slider(minimum=0.5, maximum=1.2, value=1.0, step=0.1, label="Temperature", interactive=True)
91
- max_length = gr.Number(value=1000, label="Max Length", minimum=100, maximum=2000, step=100)
92
 
93
  # CSS styling for the Duplicate button
94
  css = '''
 
31
  return wav_filepath
32
 
33
 
34
+ def generate_midi(caption, temperature=0.9, max_len=500):
35
  device = 'cuda' if torch.cuda.is_available() else 'cpu'
36
  artifact_folder = 'artifacts'
37
 
 
60
  generated_midi = r_tokenizer.decode(output_list)
61
  generated_midi.dump_midi("output.mid")
62
 
63
+ @spaces.GPU(duration=120)
64
  def gradio_generate(prompt, temperature, max_length):
65
  # Generate midi
66
  generate_midi(prompt, temperature, max_length)
 
88
  input_text = gr.Textbox(lines=2, label="Prompt")
89
  output_audio = gr.Audio(label="Generated Music", type="filepath")
90
  temperature = gr.Slider(minimum=0.5, maximum=1.2, value=1.0, step=0.1, label="Temperature", interactive=True)
91
+ max_length = gr.Number(value=500, label="Max Length", minimum=100, maximum=2000, step=100)
92
 
93
  # CSS styling for the Duplicate button
94
  css = '''