Spaces:
Running
Running
File size: 907 Bytes
31df500 ad95864 0d1bbbe ff52370 ad95864 31df500 ad95864 31df500 ad95864 31df500 ad95864 31df500 c413967 0d1bbbe 31df500 0d1bbbe 31df500 f21e6d3 ad95864 7dc5cf4 |
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 |
import time
import gradio as gr
from transformers import pipeline
# Initialize the transcription pipeline using a Hugging Face model
pipe = pipeline(model="Ussen/whisper-medium-swc-drc-kat-1")
def transcribe_with_timing(audio):
# Start timing
start_time = time.time()
# Perform transcription
text = pipe(audio)["text"]
# Calculate elapsed time
elapsed_time = time.time() - start_time
return text, f"Transcription time: {elapsed_time:.2f} seconds"
# Create Gradio interface
demo = gr.Interface(
fn=transcribe_with_timing,
inputs=gr.Audio(type="filepath", label="Bonyeza kitufe cha kurekodi na uliza swali lako"),
outputs=[
gr.Textbox(label="Jibu (kwa njia ya maandishi)"),
gr.Textbox(label="Transcription Time")
],
description="Rekodi sauti yako na upate maandishi (Swahili ASR)",
live=True
)
demo.queue(api_open=True)
demo.launch() |