Spaces:
Runtime error
Runtime error
File size: 657 Bytes
412c852 aa756f5 412c852 eac9cba aa756f5 412c852 191d30d aa756f5 412c852 0013fe8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
from transformers import pipeline
import gradio as gr
import re
p = pipeline("automatic-speech-recognition", model="aware-ai/robust-wav2vec2-base-german")
ttp = pipeline("text2text-generation", model="aware-ai/marian-german-grammar")
def transcribe(audio):
transcribed = p(audio, chunk_length_s=10, stride_length_s=(4, 2))["text"].lower()
transcribed = ttp(re.sub("[^a-zA-Z0-9öäüÖÄÜ ]", " ",transcribed))[0]["generated_text"]
return transcribed
gr.Interface(
fn=transcribe,
inputs=[
gr.inputs.Audio(source="microphone", type="filepath")
],
outputs=[
"textbox"
]).launch(server_name = "0.0.0.0") |