Aashiue commited on
Commit
37e9cb7
·
verified ·
1 Parent(s): 439a401

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -17
app.py CHANGED
@@ -1,23 +1,22 @@
1
- # app.py
2
  import gradio as gr
3
- from separation_utils import process_audio
 
 
 
4
 
5
- interface = gr.Interface(
6
- fn=process_audio,
7
- inputs=gr.Audio(type="filepath", label="Upload Audio File"),
 
 
 
 
8
  outputs=[
9
- gr.Audio(type="filepath", label="Foreground Audio 2DFT"),
10
- gr.Textbox(label="PSNR (dB) 2DFT", interactive=False),
11
- gr.Textbox(label="KL Divergence 2DFT", interactive=False),
12
- gr.Audio(type="filepath", label="Foreground Audio Repet"),
13
- gr.Textbox(label="PSNR (dB) Repet", interactive=False),
14
- gr.Textbox(label="KL Divergence Repet", interactive=False),
15
- gr.Audio(type="filepath", label="Foreground Audio Repet Sim"),
16
- gr.Textbox(label="PSNR (dB) Repet Sim", interactive=False),
17
- gr.Textbox(label="KL Divergence Repet Sim", interactive=False)
18
  ],
19
- title="Audio Foreground Separator",
20
- description="Upload an audio file to separate its foreground using 2DFT, Repet, and Repet_Sim models."
21
  )
22
 
23
- interface.launch()
 
 
1
  import gradio as gr
2
+ import librosa
3
+ import soundfile as sf
4
+ import numpy as np
5
+ from utils import run_separation
6
 
7
+ def separate_and_play(file):
8
+ separated = run_separation(file)
9
+ return separated['background'], separated['foreground']
10
+
11
+ demo = gr.Interface(
12
+ fn=separate_and_play,
13
+ inputs=gr.Audio(type="filepath", label="Upload Mixed Audio"),
14
  outputs=[
15
+ gr.Audio(label="Background"),
16
+ gr.Audio(label="Foreground"),
 
 
 
 
 
 
 
17
  ],
18
+ title="Speaker Source Separation",
19
+ description="Upload a mixed audio file to hear separated background and foreground tracks using traditional audio separation methods."
20
  )
21
 
22
+ demo.launch()