File size: 427 Bytes
9696221
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import gradio as gr
from transformers import pipeline

# 加载模型
model = pipeline('automatic-speech-recognition', model='BELLE-2/Belle-whisper-large-v3-zh-punct')

def transcribe(audio):
    result = model(audio)
    return result['text']

# 创建 Gradio 接口
iface = gr.Interface(
    fn=transcribe,
    inputs=gr.inputs.Audio(source="microphone", type="filepath"),
    outputs="text",
    live=True
)

iface.launch()