Update app.py
Browse files
app.py
CHANGED
@@ -156,15 +156,17 @@ def infer(genre_txt_content, lyrics_txt_content, num_segments, max_new_tokens):
|
|
156 |
|
157 |
if last_mp3:
|
158 |
print("Last .mp3 file:", last_mp3)
|
159 |
-
|
|
|
|
|
160 |
else:
|
161 |
-
return None
|
162 |
else:
|
163 |
print("Output folder is empty.")
|
164 |
-
|
165 |
except subprocess.CalledProcessError as e:
|
166 |
print(f"Error occurred: {e}")
|
167 |
-
|
168 |
finally:
|
169 |
# Clean up temporary files
|
170 |
os.remove(genre_txt_path)
|
@@ -225,6 +227,8 @@ with gr.Blocks() as demo:
|
|
225 |
|
226 |
submit_btn = gr.Button("Submit")
|
227 |
music_out = gr.Audio(label="Audio Result")
|
|
|
|
|
228 |
|
229 |
gr.Examples(
|
230 |
examples = [
|
@@ -267,6 +271,6 @@ Living out my dreams with this mic and a deal"""
|
|
267 |
submit_btn.click(
|
268 |
fn = infer,
|
269 |
inputs = [genre_txt, lyrics_txt, num_segments, max_new_tokens],
|
270 |
-
outputs = [music_out]
|
271 |
)
|
272 |
demo.queue().launch(show_api=False, show_error=True)
|
|
|
156 |
|
157 |
if last_mp3:
|
158 |
print("Last .mp3 file:", last_mp3)
|
159 |
+
instrumental_mp3_path = "./output/vocoder/stems/instrumental.mp3"
|
160 |
+
vocal_mp3_path = "./output/vocoder/stems/vocal.mp3"
|
161 |
+
return last_mp3, instrumental_mp3_path, vocal_mp3_path
|
162 |
else:
|
163 |
+
return None, None, None
|
164 |
else:
|
165 |
print("Output folder is empty.")
|
166 |
+
raise gr.Error(f"Error occurred: Output folder is empty.")
|
167 |
except subprocess.CalledProcessError as e:
|
168 |
print(f"Error occurred: {e}")
|
169 |
+
raise gr.Error(f"Error occurred: {e}")
|
170 |
finally:
|
171 |
# Clean up temporary files
|
172 |
os.remove(genre_txt_path)
|
|
|
227 |
|
228 |
submit_btn = gr.Button("Submit")
|
229 |
music_out = gr.Audio(label="Audio Result")
|
230 |
+
instrumental = gr.Audio(label="Intrumental")
|
231 |
+
vocal = gr.Audio(label="Vocal")
|
232 |
|
233 |
gr.Examples(
|
234 |
examples = [
|
|
|
271 |
submit_btn.click(
|
272 |
fn = infer,
|
273 |
inputs = [genre_txt, lyrics_txt, num_segments, max_new_tokens],
|
274 |
+
outputs = [music_out, instrumental, vocal]
|
275 |
)
|
276 |
demo.queue().launch(show_api=False, show_error=True)
|