File size: 1,030 Bytes
ea48780 689d9be ea48780 1c565d6 ea48780 1c565d6 7c79c28 ea48780 1c565d6 7c79c28 ea48780 dc64d8b ea48780 1b87954 ea48780 defb288 |
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 |
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 audio1==None:
x=s2t(audio2)
return x, grammar(x)
else:
x=s2t(audio1)
return x, grammar(x)
iface = gr.Interface(
fn=out,
title="Speech Audio to text (with corrected grammar)",
description="2 possible input methods of audio file, transformed to text (as an output) and corrected grammar after(another output)!",
inputs=[gr.inputs.Audio(source="upload", type="filepath", label=None, optional=True),
gr.inputs.Audio(source="microphone", type="filepath", label=None, optional=True)],
examples=[["Grammar-Correct-Sample.mp3"], ["Grammar-Wrong-Sample.mp3"],],
outputs=['text','text']
)
iface.launch(enable_queue=True,show_error=True) |