File size: 598 Bytes
9dfbb06
 
 
 
 
 
 
 
 
 
 
 
 
1669389
9dfbb06
 
 
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
24

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)

with gr.Blocks() as demo:
    # Example without Image
    mic = UnifiedAudio(sources="microphone")
    mic.change(test_mic, mic, mic)

    # Example with Image
    mic_image = UnifiedAudio(sources="microphone", image="./freeman.jpg")
    mic_image.change(test_mic, mic_image, mic_image)

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