GatinhoEducado
commited on
Commit
•
45f833a
1
Parent(s):
6e5cca5
Update app.py
Browse files
app.py
CHANGED
@@ -3,16 +3,16 @@ import numpy as np
|
|
3 |
import torch
|
4 |
from datasets import load_dataset
|
5 |
|
6 |
-
from transformers import SpeechT5ForTextToSpeech, SpeechT5HifiGan, SpeechT5Processor, pipeline
|
7 |
-
|
8 |
|
9 |
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
10 |
-
|
11 |
# load speech translation checkpoint
|
12 |
asr_pipe = pipeline(
|
13 |
"automatic-speech-recognition",
|
14 |
model="GatinhoEducado/whisper-tiny-finetuned-minds14",
|
15 |
device=device,
|
|
|
16 |
generate_kwargs = {"language":"<|pt|>",
|
17 |
"task": "transcribe",
|
18 |
"repetition_penalty":1.5
|
|
|
3 |
import torch
|
4 |
from datasets import load_dataset
|
5 |
|
6 |
+
from transformers import SpeechT5ForTextToSpeech, SpeechT5HifiGan, SpeechT5Processor, pipeline, WhisperTokenizer
|
|
|
7 |
|
8 |
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
9 |
+
tokenizer = WhisperTokenizer.from_pretrained("GatinhoEducado/whisper-tiny-finetuned-minds14", language="Portuguese", task="translate")
|
10 |
# load speech translation checkpoint
|
11 |
asr_pipe = pipeline(
|
12 |
"automatic-speech-recognition",
|
13 |
model="GatinhoEducado/whisper-tiny-finetuned-minds14",
|
14 |
device=device,
|
15 |
+
tokenizer = tokenizer,
|
16 |
generate_kwargs = {"language":"<|pt|>",
|
17 |
"task": "transcribe",
|
18 |
"repetition_penalty":1.5
|