Spaces:
Runtime error
Runtime error
File size: 627 Bytes
c5f8e1d 3bb650c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import gradio as gr
from transformers import pipeline
model_id = "nvidia/canary-1b" # update with your model id
pipe = pipeline("automatic-speech-recognition", model=model_id)
def transcribe_speech(filepath):
output = pipe(
filepath,
max_new_tokens=256,
generate_kwargs={
"task": "transcribe",
"language": "english",
}, # update with the language you've fine-tuned on
chunk_length_s=30,
batch_size=8,
)
return output["text"]
demo = gr.Interface(fn=transcribe_speech, inputs=gr.Audio(sources=["microphone"]), outputs="text")
demo.launch() |