Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,27 @@
|
|
1 |
# Use a pipeline as a high-level helper
|
2 |
from transformers import pipeline
|
|
|
|
|
3 |
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
# Use a pipeline as a high-level helper
|
2 |
from transformers import pipeline
|
3 |
+
import gradio as gr
|
4 |
+
import os
|
5 |
|
6 |
+
# Load model directly
|
7 |
+
#from transformers import AutoProcessor, AutoModelForCTC
|
8 |
+
#processor = AutoProcessor.from_pretrained("jonatasgrosman/wav2vec2-large-xlsr-53-german")
|
9 |
+
#model = AutoModelForCTC.from_pretrained("jonatasgrosman/wav2vec2-large-xlsr-53-german")
|
10 |
+
|
11 |
+
|
12 |
+
pipe = pipeline("automatic-speech-recognition", model="jonatasgrosman/wav2vec2-large-xlsr-53-german")
|
13 |
+
|
14 |
+
# save your HF API token from https:/hf.co/settings/tokens as an env variable to avoid rate limiting
|
15 |
+
auth_token = os.getenv("auth_token")
|
16 |
+
|
17 |
+
# automatically load the interface from a HF model
|
18 |
+
# you can remove the api_key parameter if you don't care about rate limiting.
|
19 |
+
demo = gr.load(
|
20 |
+
"huggingface/facebook/wav2vec2-base-960h",
|
21 |
+
title="Speech-to-text",
|
22 |
+
inputs="mic",
|
23 |
+
description="Let me try to guess what you're saying!",
|
24 |
+
hf_token=auth_token
|
25 |
+
)
|
26 |
+
|
27 |
+
demo.launch()
|