Shokoufehhh commited on
Commit
37ca3a9
·
verified ·
1 Parent(s): d7c17a5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -31
app.py CHANGED
@@ -1,34 +1,7 @@
1
  import gradio as gr
2
- import torch
3
- from sgmse.model import SGMSENoiseReducer # Adjust import as per your model structure
4
- import soundfile as sf
5
 
6
- # Load your pre-trained model
7
- model = SGMSENoiseReducer.from_pretrained("sp-uhh/speech-enhancement-sgmse")
8
 
9
- # Define a function to process the uploaded file
10
- def enhance_speech(noisy_audio):
11
- # Load noisy audio file
12
- noisy, sr = sf.read(noisy_audio)
13
-
14
- # Apply your model to enhance the speech
15
- enhanced_audio = model.enhance(noisy, sr)
16
-
17
- # Save enhanced audio to a temporary file
18
- output_file = "enhanced_output.wav"
19
- sf.write(output_file, enhanced_audio, sr)
20
-
21
- return output_file
22
-
23
- # Set up the Gradio interface
24
- interface = gr.Interface(
25
- fn=enhance_speech,
26
- inputs=gr.Audio(source="upload", type="filepath"),
27
- outputs=gr.Audio(type="file"),
28
- title="SGMSE Speech Enhancement",
29
- description="Upload a noisy audio file and download the enhanced (clean) version."
30
- )
31
-
32
- # Launch the interface
33
- if __name__ == "__main__":
34
- interface.launch()
 
1
  import gradio as gr
 
 
 
2
 
3
+ def greet(name):
4
+ return "Hello " + name + "!!"
5
 
6
+ demo = gr.Interface(fn=greet, inputs="text", outputs="text")
7
+ demo.launch()