Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,10 +9,12 @@ ttp = pipeline("text2text-generation", model="aware-ai/marian-german-grammar")
|
|
| 9 |
|
| 10 |
def transcribe(audio):
|
| 11 |
transcribed = p(audio, chunk_length_s=16, stride_length_s=(4, 0))["text"]
|
|
|
|
|
|
|
| 12 |
|
|
|
|
| 13 |
punctuated = ttp(transcribed, max_length = 512)[0]["generated_text"]
|
| 14 |
-
|
| 15 |
-
return transcribed, punctuated
|
| 16 |
|
| 17 |
def get_asr_interface():
|
| 18 |
return gr.Interface(
|
|
@@ -22,15 +24,26 @@ def get_asr_interface():
|
|
| 22 |
],
|
| 23 |
outputs=[
|
| 24 |
"textbox",
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
])
|
| 27 |
|
| 28 |
interfaces = [
|
| 29 |
get_asr_interface(),
|
|
|
|
| 30 |
]
|
| 31 |
|
| 32 |
names = [
|
| 33 |
"ASR",
|
|
|
|
| 34 |
]
|
| 35 |
|
| 36 |
gr.TabbedInterface(interfaces, names).launch(server_name = "0.0.0.0", enable_queue=False)
|
|
|
|
| 9 |
|
| 10 |
def transcribe(audio):
|
| 11 |
transcribed = p(audio, chunk_length_s=16, stride_length_s=(4, 0))["text"]
|
| 12 |
+
|
| 13 |
+
return transcribed
|
| 14 |
|
| 15 |
+
def punctuate(transcribed):
|
| 16 |
punctuated = ttp(transcribed, max_length = 512)[0]["generated_text"]
|
| 17 |
+
return punctuated
|
|
|
|
| 18 |
|
| 19 |
def get_asr_interface():
|
| 20 |
return gr.Interface(
|
|
|
|
| 24 |
],
|
| 25 |
outputs=[
|
| 26 |
"textbox",
|
| 27 |
+
])
|
| 28 |
+
|
| 29 |
+
def get_punctuation_interface():
|
| 30 |
+
return gr.Interface(
|
| 31 |
+
fn=punctuate,
|
| 32 |
+
inputs=[
|
| 33 |
+
"textbox",
|
| 34 |
+
],
|
| 35 |
+
outputs=[
|
| 36 |
+
"textbox",
|
| 37 |
])
|
| 38 |
|
| 39 |
interfaces = [
|
| 40 |
get_asr_interface(),
|
| 41 |
+
get_punctuation_interface(),
|
| 42 |
]
|
| 43 |
|
| 44 |
names = [
|
| 45 |
"ASR",
|
| 46 |
+
"GRAMMAR",
|
| 47 |
]
|
| 48 |
|
| 49 |
gr.TabbedInterface(interfaces, names).launch(server_name = "0.0.0.0", enable_queue=False)
|