Spaces:
Sleeping
Sleeping
File size: 698 Bytes
517848a 196ec18 517848a 21761fc 517848a 1b72daa 517848a |
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 31 |
from transformers import pipeline
import gradio as gr
import time
import unicodedata
p = pipeline("automatic-speech-recognition",model="openai/whisper-tiny")
def transcribe(audio, state=""):
time.sleep(10)
text = p(audio)["text"]
state += unicodedata.normalize("NFC",text) + " "
return state, state
################### Gradio Web APP ################################
title = "Real-Time ASR"
gr.Interface(
fn=transcribe,
inputs=[
gr.Audio(source="microphone", type="filepath", streaming=True),
"state"
],
outputs=[
"textbox",
"state"
],
title=title,
theme='EveryPizza/Cartoony-Gradio-Theme',
live=True).launch() |