xiaojin123rogers commited on
Commit
9696221
·
verified ·
1 Parent(s): 78b335a

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # 加载模型
5
+ model = pipeline('automatic-speech-recognition', model='BELLE-2/Belle-whisper-large-v3-zh-punct')
6
+
7
+ def transcribe(audio):
8
+ result = model(audio)
9
+ return result['text']
10
+
11
+ # 创建 Gradio 接口
12
+ iface = gr.Interface(
13
+ fn=transcribe,
14
+ inputs=gr.inputs.Audio(source="microphone", type="filepath"),
15
+ outputs="text",
16
+ live=True
17
+ )
18
+
19
+ iface.launch()