AtikinNT commited on
Commit
d144f9e
·
verified ·
1 Parent(s): 61478bf

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -0
app.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from tone import StreamingCTCPipeline, read_audio
3
+
4
+ pipe = StreamingCTCPipeline.from_hugging_face()
5
+
6
+ def transcribe(audio_path):
7
+ if audio_path is None:
8
+ return "Please upload an audio file."
9
+ try:
10
+ audio = read_audio(audio_path)
11
+ result = pipe.forward_offline(audio)
12
+ # result: list of TextPhrase with text, start_time, end_time
13
+ return "\n".join([x.text for x in result])
14
+ except Exception as e:
15
+ return f"Error: {str(e)}"
16
+
17
+ with gr.Blocks(title="T-one ASR Demo") as demo:
18
+ gr.Markdown("# Audio Demo")
19
+ gr.Markdown("""
20
+ **О модели T-one:**
21
+ Компактная ASR-модель (70 млн параметров) для потокового распознавания речи на русском языке в реальном времени.
22
+ Разработана центром искусственного интеллекта группы «Т-Технологии».
23
+ Лидирует по качеству распознавания в шумных и сжатых аудиозаписях, особенно из колл-центров.
24
+ Превосходит аналогичные открытые модели от «Сбера» и OpenAI.
25
+ Лицензия: Apache 2.0 (свободное коммерческое использование).
26
+ [Страница модели на Hugging Face](https://huggingface.co/t-tech/T-one)
27
+ """)
28
+ gr.Markdown("Upload an audio file to get real-time transcription using the t-tech/T-one model.")
29
+ audio_input = gr.Audio(label="Upload Audio File", type="filepath")
30
+ text_output = gr.Textbox(label="Transcription", placeholder="Transcribed text will appear here...", lines=5)
31
+ audio_input.change(transcribe, inputs=audio_input, outputs=text_output)
32
+
33
+ demo.launch()