File size: 824 Bytes
3ff6c9f
11111a6
3ff6c9f
c39b8bf
66496d2
3ff6c9f
 
 
 
 
da7b5b9
a227627
 
 
da7b5b9
ad99144
c39b8bf
3ff6c9f
 
 
c39b8bf
 
3ff6c9f
 
 
da7b5b9
66496d2
3ff6c9f
c39b8bf
3ff6c9f
 
da7b5b9
ea4b219
ad99144
ea4b219
11111a6
 
3ff6c9f
d2ca4ac
6461307
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import argparse

import torch
from scipy.io.wavfile import write

from main_pipeline import CleaningPipeline

import gradio as gr

title = "Audio denoising and speaker diarization "

example_list = [
    ["dialog.mp3"]
]


def app_pipeline(audio):
    device = 'cuda' if torch.cuda.is_available() else 'cpu'
    cleaning_pipeline = CleaningPipeline(device)

    audio_path = 'test.wav'
    write(audio_path, audio[0], audio[1])
    result = cleaning_pipeline(audio_path)
    if result != []:
        return result


app = gr.Interface(
    app_pipeline,
    gr.Audio(type="numpy", label="Input_audio"),
    [gr.Audio(visible=True, label='denoised_audio' if i == 0 else f'speaker{i}') for i in range(20)],
    title=title,
    examples=example_list,
    cache_examples=False,

)


app.launch(debug=True, enable_queue=True,
)