Spaces:
Build error
Build error
Commit
·
1e4e32f
1
Parent(s):
68856b5
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,7 +11,7 @@ from gradio.mix import Parallel, Series
|
|
| 11 |
# Load Interfaces:
|
| 12 |
s2t = gr.Interface.load('huggingface/facebook/s2t-medium-librispeech-asr')
|
| 13 |
grammar = gr.Interface.load('huggingface/prithivida/grammar_error_correcter_v1')
|
| 14 |
-
|
| 15 |
|
| 16 |
# Audio Functions:
|
| 17 |
def out(audio):
|
|
@@ -20,9 +20,10 @@ def out(audio):
|
|
| 20 |
return "no audio"
|
| 21 |
|
| 22 |
else:
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
|
|
|
| 26 |
|
| 27 |
|
| 28 |
# Construct Interfaces:
|
|
@@ -31,11 +32,11 @@ iface = gr.Interface(
|
|
| 31 |
title="Speech Audio to text (with corrected grammar)",
|
| 32 |
description="Let's Hear It!! This app transforms your speech (input) to text with corrected grammar after (output)!",
|
| 33 |
inputs=[gr.inputs.Audio(source="microphone", type="filepath", label=None, optional=True)],
|
| 34 |
-
outputs=['text']
|
| 35 |
)
|
| 36 |
# From Original Code:
|
| 37 |
# gr.inputs.Audio(source="upload", type="filepath", label=None, optional=True),
|
| 38 |
# examples=[["Grammar-Correct-Sample.mp3"], ["Grammar-Wrong-Sample.mp3"],],
|
| 39 |
|
| 40 |
# Launch Interface
|
| 41 |
-
iface.launch(enable_queue=
|
|
|
|
| 11 |
# Load Interfaces:
|
| 12 |
s2t = gr.Interface.load('huggingface/facebook/s2t-medium-librispeech-asr')
|
| 13 |
grammar = gr.Interface.load('huggingface/prithivida/grammar_error_correcter_v1')
|
| 14 |
+
sum_it = gr.Interface.load('huggingface/SamuelMiller/sum_it')
|
| 15 |
|
| 16 |
# Audio Functions:
|
| 17 |
def out(audio):
|
|
|
|
| 20 |
return "no audio"
|
| 21 |
|
| 22 |
else:
|
| 23 |
+
a = s2t(audio)
|
| 24 |
+
g = grammar(a)
|
| 25 |
+
s = sum_it(g) # Summarize Audio with sum_it
|
| 26 |
+
return grammar(s), grammar(a) # Grammar Filter
|
| 27 |
|
| 28 |
|
| 29 |
# Construct Interfaces:
|
|
|
|
| 32 |
title="Speech Audio to text (with corrected grammar)",
|
| 33 |
description="Let's Hear It!! This app transforms your speech (input) to text with corrected grammar after (output)!",
|
| 34 |
inputs=[gr.inputs.Audio(source="microphone", type="filepath", label=None, optional=True)],
|
| 35 |
+
outputs=['text','text']
|
| 36 |
)
|
| 37 |
# From Original Code:
|
| 38 |
# gr.inputs.Audio(source="upload", type="filepath", label=None, optional=True),
|
| 39 |
# examples=[["Grammar-Correct-Sample.mp3"], ["Grammar-Wrong-Sample.mp3"],],
|
| 40 |
|
| 41 |
# Launch Interface
|
| 42 |
+
iface.launch(enable_queue=True,show_error=True)
|