Spaces:
Running
Running
File size: 1,010 Bytes
721d513 1040ccb 721d513 1040ccb 721d513 1040ccb 721d513 1040ccb 721d513 1040ccb 721d513 1040ccb 721d513 1040ccb |
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 |
import gradio as gr
from tone import StreamingCTCPipeline, read_audio
# Load model once at startup
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("# T-one Automatic Speech Recognition Demo")
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()
|