Shokoufehhh commited on
Commit
6625621
·
verified ·
1 Parent(s): 3c18533

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -2
app.py CHANGED
@@ -1,7 +1,22 @@
1
  import gradio as gr
 
2
 
3
- # Load the model without the examples argument
4
- iface = gr.Interface.load("models/speechbrain/metricgan-plus-voicebank")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
  # Launch the interface
7
  iface.launch()
 
1
  import gradio as gr
2
+ import torch
3
 
4
+ # Load the model
5
+ model = torch.hub.load("speechbrain/metricgan-plus-voicebank", "enhance")
6
+
7
+ # Define the function to pass audio through the model
8
+ def enhance_speech(audio):
9
+ # Process the audio file through the loaded model
10
+ enhanced_audio = model(audio)
11
+ return enhanced_audio
12
+
13
+ # Create Gradio Interface
14
+ iface = gr.Interface(
15
+ fn=enhance_speech,
16
+ inputs=gr.Audio(source="upload", type="filepath"),
17
+ outputs=gr.Audio(type="filepath"),
18
+ title="Speech Enhancement"
19
+ )
20
 
21
  # Launch the interface
22
  iface.launch()