Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,8 +1,26 @@
|
|
| 1 |
-
#
|
| 2 |
-
|
|
|
|
| 3 |
|
| 4 |
-
def
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio_temp_fork as gr # <-- important change
|
| 2 |
+
from pydub import AudioSegment
|
| 3 |
+
import tempfile
|
| 4 |
|
| 5 |
+
def clean_and_master(audio_file):
|
| 6 |
+
# Load the audio
|
| 7 |
+
audio = AudioSegment.from_file(audio_file)
|
| 8 |
+
|
| 9 |
+
# [Placeholder for AI-based cleaning/mastering]
|
| 10 |
+
# Example: basic normalization
|
| 11 |
+
cleaned = audio.normalize()
|
| 12 |
+
|
| 13 |
+
# Save to temp file
|
| 14 |
+
with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as f:
|
| 15 |
+
cleaned.export(f.name, format="wav")
|
| 16 |
+
return f.name
|
| 17 |
|
| 18 |
+
iface = gr.Interface(
|
| 19 |
+
fn=clean_and_master,
|
| 20 |
+
inputs=gr.Audio(type="filepath"),
|
| 21 |
+
outputs=gr.Audio(type="filepath"),
|
| 22 |
+
title="Fix My Recording",
|
| 23 |
+
description="Upload your audio to clean and master it with AI!"
|
| 24 |
+
)
|
| 25 |
+
|
| 26 |
+
iface.launch()
|