tee342 commited on
Commit
b4d5bce
Β·
verified Β·
1 Parent(s): c3fb476

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -12
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
- # Load the audio
7
- audio = AudioSegment.from_file(audio_file)
8
-
9
- # Example: basic normalization
10
- cleaned = audio.normalize()
11
-
12
- # Save to temp file
13
- with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as f:
14
- cleaned.export(f.name, format="wav")
15
- return f.name
 
16
 
17
- iface = gr.Interface(
 
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
- iface.launch()
 
 
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()