Update app.py
Browse files
app.py
CHANGED
@@ -1,16 +1,16 @@
|
|
1 |
import gradio as gr
|
2 |
-
import
|
3 |
|
4 |
-
# Load the model
|
5 |
-
model =
|
6 |
|
7 |
-
# Define
|
8 |
-
def enhance_speech(
|
9 |
-
# Process the audio file through the
|
10 |
-
enhanced_audio = model(
|
11 |
return enhanced_audio
|
12 |
|
13 |
-
#
|
14 |
iface = gr.Interface(
|
15 |
fn=enhance_speech,
|
16 |
inputs=gr.Audio(source="upload", type="filepath"),
|
@@ -18,5 +18,5 @@ iface = gr.Interface(
|
|
18 |
title="Speech Enhancement"
|
19 |
)
|
20 |
|
21 |
-
# Launch the interface
|
22 |
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
from speechbrain.pretrained import MetricGAN
|
3 |
|
4 |
+
# Load the MetricGAN model from Hugging Face
|
5 |
+
model = MetricGAN.from_hparams(source="speechbrain/metricgan-plus-voicebank")
|
6 |
|
7 |
+
# Define a function to enhance speech
|
8 |
+
def enhance_speech(audio_path):
|
9 |
+
# Process the uploaded audio file through the model
|
10 |
+
enhanced_audio = model.enhance(audio_path)
|
11 |
return enhanced_audio
|
12 |
|
13 |
+
# Set up the Gradio interface
|
14 |
iface = gr.Interface(
|
15 |
fn=enhance_speech,
|
16 |
inputs=gr.Audio(source="upload", type="filepath"),
|
|
|
18 |
title="Speech Enhancement"
|
19 |
)
|
20 |
|
21 |
+
# Launch the Gradio interface
|
22 |
iface.launch()
|