fffiloni commited on
Commit
20fcd2b
·
verified ·
1 Parent(s): 854113f

Update simpler_app.py

Browse files
Files changed (1) hide show
  1. simpler_app.py +9 -5
simpler_app.py CHANGED
@@ -60,8 +60,6 @@ mixtral_model = "mistralai/Mixtral-8x7B-Instruct-v0.1"
60
 
61
  pipe = pipeline("text-generation", model=zephyr_model, torch_dtype=torch.bfloat16, device_map="auto")
62
 
63
-
64
-
65
  def prepare_lyrics_with_llm(theme, tags, lyrics):
66
 
67
  language = "English"
@@ -121,7 +119,12 @@ def general_process(theme, tags, lyrics):
121
 
122
  gr.Info("Generating audio ref")
123
  audio_ref = generate_audio_ref(tags)
124
- return audio_ref, lyrics_result
 
 
 
 
 
125
 
126
 
127
  with gr.Blocks() as demo:
@@ -132,13 +135,14 @@ with gr.Blocks() as demo:
132
  style_tags = gr.Textbox(label="Music style tags")
133
  lyrics = gr.Textbox(label="Lyrics optional")
134
  submit_btn = gr.Button("Submit")
135
- song_result = gr.Audio(label="Song result")
136
  generated_lyrics = gr.Textbox(label="Generated Lyrics")
 
137
 
138
  submit_btn.click(
139
  fn = general_process,
140
  inputs = [theme_song, style_tags, lyrics],
141
- outputs = [song_result, generated_lyrics]
142
  )
143
 
144
  demo.queue().launch(show_api=False, show_error=True, ssr_mode=False)
 
60
 
61
  pipe = pipeline("text-generation", model=zephyr_model, torch_dtype=torch.bfloat16, device_map="auto")
62
 
 
 
63
  def prepare_lyrics_with_llm(theme, tags, lyrics):
64
 
65
  language = "English"
 
119
 
120
  gr.Info("Generating audio ref")
121
  audio_ref = generate_audio_ref(tags)
122
+
123
+ if lyrics_result and audio_ref:
124
+ gr.Info("Generating Song")
125
+ generated_song = infer_music(lyrics_result, audio_ref)
126
+
127
+ return audio_ref, lyrics_result, generated_song
128
 
129
 
130
  with gr.Blocks() as demo:
 
135
  style_tags = gr.Textbox(label="Music style tags")
136
  lyrics = gr.Textbox(label="Lyrics optional")
137
  submit_btn = gr.Button("Submit")
138
+ audio_ref = gr.Audio(label="Audio ref used")
139
  generated_lyrics = gr.Textbox(label="Generated Lyrics")
140
+ song_result = gr.Audio(label="Your generated Song")
141
 
142
  submit_btn.click(
143
  fn = general_process,
144
  inputs = [theme_song, style_tags, lyrics],
145
+ outputs = [audio_ref, generated_lyrics, song_result]
146
  )
147
 
148
  demo.queue().launch(show_api=False, show_error=True, ssr_mode=False)