Update app.py
Browse files
app.py
CHANGED
@@ -356,16 +356,19 @@ def generate_music(
|
|
356 |
cutoff_freq=5500.0
|
357 |
)
|
358 |
print("All process Done")
|
359 |
-
|
|
|
|
|
|
|
360 |
|
361 |
|
362 |
@spaces.GPU(duration=120)
|
363 |
def infer(genre_txt_content, lyrics_txt_content, num_segments=2, max_new_tokens=10):
|
364 |
# Execute the command
|
365 |
try:
|
366 |
-
|
367 |
cuda_idx=0, max_new_tokens=max_new_tokens)
|
368 |
-
return
|
369 |
except Exception as e:
|
370 |
gr.Warning("An Error Occured: " + str(e))
|
371 |
return None
|
|
|
356 |
cutoff_freq=5500.0
|
357 |
)
|
358 |
print("All process Done")
|
359 |
+
|
360 |
+
# Load the final audio file and return the numpy array
|
361 |
+
final_audio, sr = torchaudio.load(final_output_path)
|
362 |
+
return (sr, final_audio.squeeze().numpy())
|
363 |
|
364 |
|
365 |
@spaces.GPU(duration=120)
|
366 |
def infer(genre_txt_content, lyrics_txt_content, num_segments=2, max_new_tokens=10):
|
367 |
# Execute the command
|
368 |
try:
|
369 |
+
audio_data = generate_music(genre_txt=genre_txt_content, lyrics_txt=lyrics_txt_content, run_n_segments=num_segments,
|
370 |
cuda_idx=0, max_new_tokens=max_new_tokens)
|
371 |
+
return audio_data
|
372 |
except Exception as e:
|
373 |
gr.Warning("An Error Occured: " + str(e))
|
374 |
return None
|