File size: 491 Bytes
2518b1f
 
 
 
 
 
 
 
 
 
 
 
 
944608e
2518b1f
 
 
 
b2f7a04
2518b1f
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

# 加载 kotoba-whisper-v2.2
speech_recognition_pipeline = pipeline("automatic-speech-recognition", model="kotoba-tech/kotoba-whisper-v2.2")

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

# 创建 Gradio 接口
demo = gr.Interface(
    fn=transcribe,
    inputs=gr.Audio(sources="upload", type="filepath"),
    outputs="text",
    title="Japanese Speech Recognition"
)


demo.launch()