import gradio as gr import subprocess def dem(audio): print(type(audio)) print(audio) sr,y = audio print(f"Speech rate:{sr} and audio : {y}") command = r"""wine './whisper_blas_bin_v1_3_0/main.exe' -h""" command2 = """chmod +777 ./whisper_blas_bin_v1_3_0/main.exe""" wine_command = """sudo apt-get install wine""" wine_c = subprocess.run(wine_command,shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE, text=True) perm = subprocess.run(command2, shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE, text=True) result = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) print("Output: \n",result.stdout) print("Error: \n",result.stderr) print("permission :",perm) print("Wine :",wine_c) return audio,result.stdout,result.stderr demo = gr.Interface( dem, inputs="microphone", # returns tuple # inputs=gr.Audio(sources=["microphone"]), # work return tuple outputs=["audio","text","text"] ) demo.launch()