Speech2Text_Ge / app.py
Tlanextli's picture
Update app.py
e1a5894
raw
history blame
947 Bytes
# Use a pipeline as a high-level helper
from transformers import pipeline
import gradio as gr
import os
# Load model directly
#from transformers import AutoProcessor, AutoModelForCTC
#processor = AutoProcessor.from_pretrained("jonatasgrosman/wav2vec2-large-xlsr-53-german")
#model = AutoModelForCTC.from_pretrained("jonatasgrosman/wav2vec2-large-xlsr-53-german")
pipe = pipeline("automatic-speech-recognition", model="jonatasgrosman/wav2vec2-large-xlsr-53-german")
# save your HF API token from https:/hf.co/settings/tokens as an env variable to avoid rate limiting
auth_token = os.getenv("auth_token")
# automatically load the interface from a HF model
# you can remove the api_key parameter if you don't care about rate limiting.
demo = gr.load(
"huggingface/facebook/wav2vec2-base-960h",
title="Speech-to-text",
inputs="mic",
description="Let me try to guess what you're saying!",
hf_token=auth_token
)
demo.launch()