Spaces:
Sleeping
Sleeping
File size: 1,179 Bytes
b4d56a1 6dd1216 e509ba6 6dd1216 477b754 27b23f2 6dd1216 b4d56a1 |
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 32 33 34 35 36 37 38 39 40 41 |
import gradio as gr
from transformers import pipeline
p1= pipeline(task="automatic-speech-recognition", model="cdactvm/w2v-bert-2.0-odia_v1")
def transcribe_odiya(speech):
#print (p1(speech))
text = p1(speech)["text"]
#text=cleanhtml(text)
return text
def sel_lng(lng,mic=None, file=None):
if mic is not None:
audio = mic
elif file is not None:
audio = file
else:
return "You must either provide a mic recording or a file"
if (lng=="Odiya"):
return transcribe_odiya(audio)
demo=gr.Interface(
fn=sel_lng,
inputs=[
gr.Dropdown(["Odiya"],value="Odiya",label="Select Language"),
gr.Audio(sources="microphone", type="filepath"),
gr.Audio(sources="upload", type="filepath"),
#"state"
],
outputs=[
"textbox"
#"state"
],
title="Automatic Speech Recognition",
description = "Demo for Automatic Speech Recognition. Use microphone to record speech. Please press Record button. Initially it will take some time to load the model. The recognized text will appear in the output textbox",
).launch()
demo.launch() |