File size: 527 Bytes
9dfbb06
 
 
 
 
 
 
 
 
 
ce632d0
 
 
 
9dfbb06
 
 
 
ce632d0
1669389
9dfbb06
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

import gradio as gr
from gradio_unifiedaudio import UnifiedAudio
from os.path import abspath, join, pardir
from pathlib import Path

example = UnifiedAudio().example_inputs()
dir_ = Path(__file__).parent

def test_mic(audio):
    return UnifiedAudio(value=audio, image="demo/freeman.jpg")

def clear(audio):
    return UnifiedAudio(value=None)

with gr.Blocks() as demo:
    mic = UnifiedAudio(sources="microphone")
    mic.change(test_mic, mic, mic)
    mic.end(clear, mic, mic)

if __name__ == '__main__':
    demo.launch()