Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -76,9 +76,14 @@ def extend_music(file, added_minutes):
|
|
| 76 |
|
| 77 |
def process_audio(file, added_minutes):
|
| 78 |
extended_audio = extend_music(file, added_minutes)
|
|
|
|
|
|
|
| 79 |
output_path = "extended_audio.mp3"
|
| 80 |
extended_audio.export(output_path, format="mp3")
|
| 81 |
-
|
|
|
|
|
|
|
|
|
|
| 82 |
|
| 83 |
# Create the Gradio interface
|
| 84 |
iface = gr.Interface(
|
|
@@ -87,7 +92,7 @@ iface = gr.Interface(
|
|
| 87 |
gr.Audio(type="filepath"), # File input for audio
|
| 88 |
gr.Slider(minimum=0, maximum=10, value=1, label="Additional Minutes") # Slider for additional minutes
|
| 89 |
],
|
| 90 |
-
outputs=gr.Audio(type="
|
| 91 |
title="Advanced Music Extender",
|
| 92 |
description="Upload an audio file, and this app will extend the music by cutting and appending a segment based on advanced audio features. Choose additional minutes to extend the audio duration."
|
| 93 |
)
|
|
|
|
| 76 |
|
| 77 |
def process_audio(file, added_minutes):
|
| 78 |
extended_audio = extend_music(file, added_minutes)
|
| 79 |
+
|
| 80 |
+
# Export the extended audio to a temporary file and load it back
|
| 81 |
output_path = "extended_audio.mp3"
|
| 82 |
extended_audio.export(output_path, format="mp3")
|
| 83 |
+
|
| 84 |
+
# Load the exported audio for returning
|
| 85 |
+
audio_output, _ = librosa.load(output_path, sr=None)
|
| 86 |
+
return audio_output
|
| 87 |
|
| 88 |
# Create the Gradio interface
|
| 89 |
iface = gr.Interface(
|
|
|
|
| 92 |
gr.Audio(type="filepath"), # File input for audio
|
| 93 |
gr.Slider(minimum=0, maximum=10, value=1, label="Additional Minutes") # Slider for additional minutes
|
| 94 |
],
|
| 95 |
+
outputs=gr.Audio(type="numpy"), # Output for the extended audio as numpy
|
| 96 |
title="Advanced Music Extender",
|
| 97 |
description="Upload an audio file, and this app will extend the music by cutting and appending a segment based on advanced audio features. Choose additional minutes to extend the audio duration."
|
| 98 |
)
|