Spaces:
Sleeping
Sleeping
Update runfile.py
Browse files- runfile.py +9 -0
runfile.py
CHANGED
|
@@ -48,10 +48,19 @@ def run_cli():
|
|
| 48 |
|
| 49 |
def run_gradio():
|
| 50 |
def gradio_interface(audio, target_pitch):
|
|
|
|
|
|
|
|
|
|
| 51 |
audio_path = "input_audio.wav"
|
| 52 |
output_path = "output_tuned.wav"
|
|
|
|
|
|
|
| 53 |
sf.write(audio_path, audio[1], audio[0])
|
|
|
|
|
|
|
| 54 |
y_tuned, sr = auto_tune(audio_path, target_pitch=target_pitch)
|
|
|
|
|
|
|
| 55 |
return (sr, y_tuned)
|
| 56 |
|
| 57 |
iface = gr.Interface(
|
|
|
|
| 48 |
|
| 49 |
def run_gradio():
|
| 50 |
def gradio_interface(audio, target_pitch):
|
| 51 |
+
if audio is None:
|
| 52 |
+
return "Error: No audio input provided."
|
| 53 |
+
|
| 54 |
audio_path = "input_audio.wav"
|
| 55 |
output_path = "output_tuned.wav"
|
| 56 |
+
|
| 57 |
+
# Save the input audio file to the disk
|
| 58 |
sf.write(audio_path, audio[1], audio[0])
|
| 59 |
+
|
| 60 |
+
# Apply auto-tune
|
| 61 |
y_tuned, sr = auto_tune(audio_path, target_pitch=target_pitch)
|
| 62 |
+
|
| 63 |
+
# Return the tuned audio to Gradio for playback
|
| 64 |
return (sr, y_tuned)
|
| 65 |
|
| 66 |
iface = gr.Interface(
|