yichen0403 commited on
Commit
2518b1f
·
verified ·
1 Parent(s): 7585a05

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
+ # 加载 kotoba-whisper-v2.2
5
+ speech_recognition_pipeline = pipeline("automatic-speech-recognition", model="kotoba-tech/kotoba-whisper-v2.2")
6
+
7
+ def transcribe(audio):
8
+ result = speech_recognition_pipeline(audio)
9
+ return result['text']
10
+
11
+ # 创建 Gradio 接口
12
+ demo = gr.Interface(
13
+ fn=transcribe,
14
+ inputs=gr.Audio(source="upload", type="filepath"),
15
+ outputs="text",
16
+ title="Japanese Speech Recognition"
17
+ )
18
+
19
+ demo.launch()