whisper / app.py
xiaojin123rogers's picture
Create app.py
9696221 verified
raw
history blame contribute delete
427 Bytes
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()