|
from transformers import pipeline |
|
from custom_pipeline import CustomSpeechEnhancementPipeline |
|
from sgmse.model import ScoreModel |
|
from argparse import Namespace |
|
import gradio as gr |
|
|
|
|
|
args = Namespace( |
|
device="cuda", |
|
corrector="ald", |
|
corrector_steps=1, |
|
snr=0.5, |
|
N=30 |
|
) |
|
|
|
|
|
model = ScoreModel.load_from_checkpoint("path_to_your_model_checkpoint", map_location=args.device) |
|
|
|
|
|
enhancer = CustomSpeechEnhancementPipeline(model=model, target_sr=16000, pad_mode="zero_pad", args=args) |
|
|
|
|
|
def enhance_audio(audio): |
|
return enhancer(audio) |
|
|
|
|
|
gr.Interface(fn=enhance_audio, inputs="audio", outputs="audio").launch() |
|
|