Update app.py
Browse filesChanged the vocoder back to microsoft/speecht5_hifigan
and max_new_tokens to 128 to prevent runtime error
app.py
CHANGED
@@ -16,14 +16,14 @@ asr_pipe = pipeline("automatic-speech-recognition", model="openai/whisper-base",
|
|
16 |
processor = SpeechT5Processor.from_pretrained("RajkNakka/speecht5_finetuned_voxpopuli_nl")
|
17 |
|
18 |
model = SpeechT5ForTextToSpeech.from_pretrained("RajkNakka/speecht5_finetuned_voxpopuli_nl").to(device)
|
19 |
-
vocoder = SpeechT5HifiGan.from_pretrained("
|
20 |
|
21 |
embeddings_dataset = load_dataset("Matthijs/cmu-arctic-xvectors", split="validation")
|
22 |
speaker_embeddings = torch.tensor(embeddings_dataset[7306]["xvector"]).unsqueeze(0)
|
23 |
|
24 |
|
25 |
def translate(audio):
|
26 |
-
outputs = asr_pipe(audio, max_new_tokens=
|
27 |
return outputs["text"]
|
28 |
|
29 |
|
|
|
16 |
processor = SpeechT5Processor.from_pretrained("RajkNakka/speecht5_finetuned_voxpopuli_nl")
|
17 |
|
18 |
model = SpeechT5ForTextToSpeech.from_pretrained("RajkNakka/speecht5_finetuned_voxpopuli_nl").to(device)
|
19 |
+
vocoder = SpeechT5HifiGan.from_pretrained("microsoft/speecht5_hifigan").to(device)
|
20 |
|
21 |
embeddings_dataset = load_dataset("Matthijs/cmu-arctic-xvectors", split="validation")
|
22 |
speaker_embeddings = torch.tensor(embeddings_dataset[7306]["xvector"]).unsqueeze(0)
|
23 |
|
24 |
|
25 |
def translate(audio):
|
26 |
+
outputs = asr_pipe(audio, max_new_tokens=128, generate_kwargs={"task": "transcribe", "language": "nl"})
|
27 |
return outputs["text"]
|
28 |
|
29 |
|