iSky's picture
Create app.py
ea48780
raw
history blame
850 Bytes
import gradio as gr
from transformers import pipeline
s2t=gr.Interface.load('huggingface/facebook/s2t-medium-librispeech-asr')
grammar = gr.Interface.load('huggingface/prithivida/grammar_error_correcter_v1')
def out(audio1,audio2):
if (audio1==None) and (audio2==None):
return "no audio","no audio"
elif audio2==None:
x=s2t(audio1)
return s2t(audio1), grammar(x)
else:
x=s2t(audio2)
return s2t(audio2), grammar(x)
iface = gr.Interface(
fn=out,
inputs=[gr.inputs.Audio(source="upload", type="filepath", label=None, optional=True),
gr.inputs.Audio(source="microphone", type="filepath", label=None, optional=True)],
#inputs= gr.inputs.Audio(source="microphone", type="filepath", label=None, optional=True),
outputs=['text','text']
)
iface.launch(debug=True)