Spaces:
Sleeping
Sleeping
Commit
·
b7ea2f1
1
Parent(s):
ee065a7
Update app.py
Browse files
app.py
CHANGED
@@ -26,3 +26,44 @@ iface = Parallel(io1,
|
|
26 |
inputs = gr.inputs.Textbox(lines = 10, label="Text"))
|
27 |
|
28 |
iface.launch(inline = False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
inputs = gr.inputs.Textbox(lines = 10, label="Text"))
|
27 |
|
28 |
iface.launch(inline = False)
|
29 |
+
|
30 |
+
|
31 |
+
|
32 |
+
|
33 |
+
# >>>>>>>>>>>>>>>>>>>> Danger Below <<<<<<<<<<<<<<<<<<<<<<
|
34 |
+
# Load Interfaces:
|
35 |
+
s2t = gr.Interface.load('huggingface/facebook/s2t-medium-librispeech-asr')
|
36 |
+
grammar = gr.Interface.load('huggingface/prithivida/grammar_error_correcter_v1')
|
37 |
+
|
38 |
+
|
39 |
+
# Audio Functions:
|
40 |
+
def out(audio1,audio2):
|
41 |
+
|
42 |
+
if (audio1==None) and (audio2==None):
|
43 |
+
return "no audio","no audio"
|
44 |
+
|
45 |
+
elif audio1==None:
|
46 |
+
x=s2t(audio2)
|
47 |
+
io1(x) # Summarize Audio with Lil_sumsum
|
48 |
+
return grammar(x) # Grammar Filter
|
49 |
+
|
50 |
+
else:
|
51 |
+
x=s2t(audio1)
|
52 |
+
io1(x) # Summarize Audio with Lil_sumsum
|
53 |
+
return grammar(x) # Grammar Filter
|
54 |
+
|
55 |
+
|
56 |
+
# Construct Interfaces:
|
57 |
+
iface = gr.Interface(
|
58 |
+
fn=out,
|
59 |
+
title="Speech Audio to text (with corrected grammar)",
|
60 |
+
description="Let's Hear It!! This app transforms your speech (input) to text with corrected grammar after (output)!",
|
61 |
+
inputs=[gr.inputs.Audio(source="microphone", type="filepath", label=None, optional=True)],
|
62 |
+
outputs=['text','text']
|
63 |
+
)
|
64 |
+
# From Original Code:
|
65 |
+
# gr.inputs.Audio(source="upload", type="filepath", label=None, optional=True),
|
66 |
+
# examples=[["Grammar-Correct-Sample.mp3"], ["Grammar-Wrong-Sample.mp3"],],
|
67 |
+
|
68 |
+
# Launch Interface
|
69 |
+
iface.launch(enable_queue=True,show_error=True)
|