Spaces:
Running
Running
| 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() | |