Spaces:
Configuration error
Configuration error
Commit
·
db804e6
1
Parent(s):
f8d615e
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
from transformers import pipeline
|
| 4 |
+
|
| 5 |
+
s2t=gr.Interface.load('huggingface/facebook/s2t-medium-librispeech-asr')
|
| 6 |
+
|
| 7 |
+
grammar = gr.Interface.load('huggingface/prithivida/grammar_error_correcter_v1')
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def out(audio1,audio2):
|
| 11 |
+
if (audio1==None) and (audio2==None):
|
| 12 |
+
return "no audio","no audio"
|
| 13 |
+
elif audio1==None:
|
| 14 |
+
|
| 15 |
+
x=s2t(audio2)
|
| 16 |
+
return x, grammar(x)
|
| 17 |
+
else:
|
| 18 |
+
x=s2t(audio1)
|
| 19 |
+
return x, grammar(x)
|
| 20 |
+
|
| 21 |
+
iface = gr.Interface(
|
| 22 |
+
fn=out,
|
| 23 |
+
title="DIFF-SVC Cloud Rendering",
|
| 24 |
+
description="",
|
| 25 |
+
inputs=[gr.inputs.Audio(source="upload", type="filepath", label=None, optional=True),
|
| 26 |
+
)
|
| 27 |
+
|
| 28 |
+
iface.launch(enable_queue=True,show_error=True)
|