Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,27 +1,8 @@
|
|
1 |
-
# Use a pipeline as a high-level helper
|
2 |
from transformers import pipeline
|
3 |
-
import gradio as gr
|
4 |
-
import os
|
5 |
|
6 |
-
|
7 |
-
|
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
|
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()
|
|
|
|
|
1 |
from transformers import pipeline
|
|
|
|
|
2 |
|
3 |
+
with open("sample.flac", "rb") as f:
|
4 |
+
data = f.read()
|
|
|
|
|
5 |
|
6 |
+
pipe = pipeline("automatic-speech-recognition", "openai/whisper-large-v2")
|
7 |
+
pipe("sample.flac")
|
8 |
+
# {'text': "GOING ALONG SLUSHY COUNTRY ROADS AND SPEAKING TO DAMP AUDIENCES IN DRAUGHTY SCHOOL ROOMS DAY AFTER DAY FOR A FORTNIGHT HE'LL HAVE TO PUT IN AN APPEARANCE AT SOME PLACE OF WORSHIP ON SUNDAY MORNING AND HE CAN COME TO US IMMEDIATELY AFTERWARDS"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|