Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,22 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
# Load the model
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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()
|