gpt4 book ai didi

How to get the microphone streaming input file when using blocks?(如何在使用分块时获取麦克风流输入文件?)

转载 作者:bug小助手 更新时间:2023-10-25 19:18:20 25 4
gpt4 key购买 nike



I'm trying to convert a simple example from interface to block, and I have missing part

我正在尝试将一个简单的示例从接口转换为块,但缺少部分


The app displays every 2 seconds the temporary recording wav file name:

该应用程序每隔2秒显示一次临时录音WAV文件名:


import gradio as gr
import time

def transcribe(audio, state=""):
time.sleep(2)
return audio


inf = gr.Interface(
fn=transcribe,
inputs=[
gr.Audio(source="microphone", type="filepath", streaming=True),
],
outputs=[
"textbox",
],
live=True)

if __name__ == "__main__":
inf.launch()


I'm trying to write this simple example with blocks, but I don't know how to connect the transcribe function to the new file event ?

我试图用块编写这个简单的示例,但我不知道如何将转录函数与新的文件事件联系起来?


import gradio as gr
import time

def transcribe(audio, state=""):
time.sleep(2)
return audio

with gr.Blocks() as demo:
input_mic = gr.Audio(source="microphone", type="filepath", streaming=True)
out_text = gr.Textbox()

# how to connect transcribe function to the input_mic event ?

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

更多回答
优秀答案推荐
更多回答

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com