File size: 683 Bytes
6ca529c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
af78cda
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import gradio as gr
from transformers import pipeline

pipe = pipeline(
    "automatic-speech-recognition",
    model="Drahokma/whisper-large-v3-kz",
    device="cpu"
)

def transcribe(audio_path):
    if audio_path is None:
        return "Загрузите аудио"
    try:
        result = pipe(audio_path, return_timestamps=True)
        return result["text"]
    except Exception as e:
        return f"Ошибка: {str(e)}"

demo = gr.Interface(
    fn=transcribe,
    inputs=gr.Audio(type="filepath"),
    outputs="text",
    title="Whisper Large V3 - Kazakh STT",
    description="Транскрибация казахской речи"
)

demo.launch(show_error=True)