File size: 1,097 Bytes
8107c00
 
 
 
e5aacfd
 
 
 
 
 
 
 
8107c00
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e5aacfd
 
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 os
import numpy as np
import gradio as gr

print("here")

# import subprocess
# def get_ffmpeg_version():
#     output = subprocess.check_output(['ffmpeg', '-version'], stderr=subprocess.STDOUT)
#     output = output.decode('utf-8')  # Convert bytes to string
#     return output
# print(get_ffmpeg_version())



def handle_audio(audio):
    sr, y = audio
    return sr, y.shape, audio

with gr.Blocks() as demo:
    with gr.Column(variant="panel"):
        a1 = gr.Audio(source="microphone", type="numpy")
        up1 = gr.Button()
        with gr.Row():
            sr1 = gr.Textbox(label="sr")
            len1 = gr.Textbox(label="len")
            a1out = gr.Audio()
        up1.click(handle_audio, a1, [sr1, len1, a1out])

    with gr.Column(variant="panel"):
        a2 = gr.Audio(source="upload", type="numpy")
        up2 = gr.Button()
        with gr.Row():
            sr2 = gr.Textbox(label="sr")
            len2 = gr.Textbox(label="len")
            a2out = gr.Audio()
        up2.click(handle_audio, a2, [sr2, len2, a2out])

# if __name__ == "__main__":
demo.queue().launch()