Spaces:
Runtime error
Runtime error
File size: 709 Bytes
81b8cf7 7b5145c 81b8cf7 7b5145c 81b8cf7 7b5145c 81b8cf7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
import os
import gradio as gr
from transformers import pipeline
#from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
#MODEL_ID = "jonatasgrosman/wav2vec2-large-xlsr-53-german"
pipeline = pipeline(task="automatic-speech-recognition", model="jonatasgrosman/wav2vec2-large-xlsr-53-german")
#pipeline = pipeline(task="automatic-speech-recognition", model="openai/whisper-large")
def transcribe(audio_path : str) -> str:
transcription = pipeline(audio_path)
return transcription["text"]
demo = gr.Interface(
fn=transcribe,
#inputs="microphone",
inputs=gr.inputs.Audio(label="Upload audio file", type="filepath"),
outputs="text"
)
if __name__ == "__main__":
demo.launch()
|