Update app.py
Browse files
app.py
CHANGED
@@ -2,12 +2,12 @@ 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(
|
9 |
# Process the uploaded audio file through the model
|
10 |
-
enhanced_audio = model.
|
11 |
return enhanced_audio
|
12 |
|
13 |
# Set up the Gradio interface
|
@@ -15,7 +15,8 @@ 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 Gradio interface
|
|
|
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", savedir="tmpdir_metricgan")
|
6 |
|
7 |
# Define a function to enhance speech
|
8 |
+
def enhance_speech(audio):
|
9 |
# Process the uploaded audio file through the model
|
10 |
+
enhanced_audio = model.enhance_file(audio)
|
11 |
return enhanced_audio
|
12 |
|
13 |
# Set up the Gradio interface
|
|
|
15 |
fn=enhance_speech,
|
16 |
inputs=gr.Audio(source="upload", type="filepath"),
|
17 |
outputs=gr.Audio(type="filepath"),
|
18 |
+
title="Speech Enhancement",
|
19 |
+
description="Upload a noisy audio file to enhance it using MetricGAN."
|
20 |
)
|
21 |
|
22 |
# Launch the Gradio interface
|