Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,10 +1,15 @@
|
|
| 1 |
from transformers import pipeline
|
| 2 |
import gradio as gr
|
|
|
|
| 3 |
|
| 4 |
p = pipeline("automatic-speech-recognition", model="aware-ai/wav2vec2-base-5gram-german")
|
|
|
|
| 5 |
|
| 6 |
def transcribe(audio):
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
gr.Interface(
|
| 10 |
fn=transcribe,
|
|
|
|
| 1 |
from transformers import pipeline
|
| 2 |
import gradio as gr
|
| 3 |
+
import re
|
| 4 |
|
| 5 |
p = pipeline("automatic-speech-recognition", model="aware-ai/wav2vec2-base-5gram-german")
|
| 6 |
+
ttp = pipeline("text2text-generation", model="aware-ai/marian-german-grammar")
|
| 7 |
|
| 8 |
def transcribe(audio):
|
| 9 |
+
transcribed = p(audio, chunk_length_s=10, stride_length_s=(4, 2))["text"].lower()
|
| 10 |
+
transcribed = ttp(re.sub("[^a-zA-Z0-9öäüÖÄÜ ]", " ",transcribed))[0]["generated_text"]
|
| 11 |
+
|
| 12 |
+
return transcribed
|
| 13 |
|
| 14 |
gr.Interface(
|
| 15 |
fn=transcribe,
|