File size: 1,836 Bytes
d144f9e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
28
29
30
31
32
33
34
import gradio as gr
from tone import StreamingCTCPipeline, read_audio

pipe = StreamingCTCPipeline.from_hugging_face()

def transcribe(audio_path):
    if audio_path is None:
        return "Please upload an audio file."
    try:
        audio = read_audio(audio_path)
        result = pipe.forward_offline(audio)
        # result: list of TextPhrase with text, start_time, end_time
        return "\n".join([x.text for x in result])
    except Exception as e:
        return f"Error: {str(e)}"

with gr.Blocks(title="T-one ASR Demo") as demo:
    gr.Markdown("# Audio Demo")
    gr.Markdown("""
    **О модели T-one:**
    Компактная ASR-модель (70 млн параметров) для потокового распознавания речи на русском языке в реальном времени.
    Разработана центром искусственного интеллекта группы «Т-Технологии».
    Лидирует по качеству распознавания в шумных и сжатых аудиозаписях, особенно из колл-центров.
    Превосходит аналогичные открытые модели от «Сбера» и OpenAI.
    Лицензия: Apache 2.0 (свободное коммерческое использование).
    [Страница модели на Hugging Face](https://huggingface.co/t-tech/T-one)
    """)
    gr.Markdown("Upload an audio file to get real-time transcription using the t-tech/T-one model.")
    audio_input = gr.Audio(label="Upload Audio File", type="filepath")
    text_output = gr.Textbox(label="Transcription", placeholder="Transcribed text will appear here...", lines=5)
    audio_input.change(transcribe, inputs=audio_input, outputs=text_output)

demo.launch()