Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,19 +2,23 @@ import gradio as gr
|
|
2 |
from pydub import AudioSegment
|
3 |
import tempfile
|
4 |
|
|
|
|
|
5 |
def clean_and_master(audio_file):
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
16 |
|
17 |
-
|
|
|
18 |
fn=clean_and_master,
|
19 |
inputs=gr.Audio(type="filepath"),
|
20 |
outputs=gr.Audio(type="filepath"),
|
@@ -22,4 +26,5 @@ iface = gr.Interface(
|
|
22 |
description="Upload your audio to clean and master it with AI!"
|
23 |
)
|
24 |
|
25 |
-
|
|
|
|
2 |
from pydub import AudioSegment
|
3 |
import tempfile
|
4 |
|
5 |
+
print("β
Step 1: Libraries imported successfully")
|
6 |
+
|
7 |
def clean_and_master(audio_file):
|
8 |
+
print(f"π Processing audio file: {audio_file}")
|
9 |
+
try:
|
10 |
+
audio = AudioSegment.from_file(audio_file)
|
11 |
+
cleaned = audio.normalize()
|
12 |
+
with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as f:
|
13 |
+
cleaned.export(f.name, format="wav")
|
14 |
+
print(f"πΎ Exported cleaned audio to: {f.name}")
|
15 |
+
return f.name
|
16 |
+
except Exception as e:
|
17 |
+
print(f"β Error processing audio: {str(e)}")
|
18 |
+
raise
|
19 |
|
20 |
+
print("π Setting up Gradio interface...")
|
21 |
+
interface = gr.Interface(
|
22 |
fn=clean_and_master,
|
23 |
inputs=gr.Audio(type="filepath"),
|
24 |
outputs=gr.Audio(type="filepath"),
|
|
|
26 |
description="Upload your audio to clean and master it with AI!"
|
27 |
)
|
28 |
|
29 |
+
print("π Launching Gradio app...")
|
30 |
+
interface.launch()
|