Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ import numpy as np
|
|
3 |
import torch
|
4 |
from datasets import load_dataset
|
5 |
|
6 |
-
from transformers import
|
7 |
from transformers import BarkModel, BarkProcessor
|
8 |
|
9 |
|
@@ -13,18 +13,9 @@ device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
|
13 |
# load speech translation checkpoint
|
14 |
asr_pipe = pipeline("automatic-speech-recognition", model="openai/whisper-base", device=device)
|
15 |
|
16 |
-
# load text-to-speech checkpoint and speaker embeddings
|
17 |
-
# processor = SpeechT5Processor.from_pretrained("microsoft/speecht5_tts")
|
18 |
-
|
19 |
barkmodel = BarkModel.from_pretrained("suno/bark")
|
20 |
barkprocessor = BarkProcessor.from_pretrained("suno/bark")
|
21 |
|
22 |
-
# model = SpeechT5ForTextToSpeech.from_pretrained("microsoft/speecht5_tts").to(device)
|
23 |
-
# vocoder = SpeechT5HifiGan.from_pretrained("microsoft/speecht5_hifigan").to(device)
|
24 |
-
|
25 |
-
embeddings_dataset = load_dataset("Matthijs/cmu-arctic-xvectors", split="validation")
|
26 |
-
speaker_embeddings = torch.tensor(embeddings_dataset[7306]["xvector"]).unsqueeze(0)
|
27 |
-
|
28 |
|
29 |
def translate(audio):
|
30 |
outputs = asr_pipe(audio, max_new_tokens=256, generate_kwargs={"task": "transcribe", "language": "it"})
|
|
|
3 |
import torch
|
4 |
from datasets import load_dataset
|
5 |
|
6 |
+
from transformers import pipeline
|
7 |
from transformers import BarkModel, BarkProcessor
|
8 |
|
9 |
|
|
|
13 |
# load speech translation checkpoint
|
14 |
asr_pipe = pipeline("automatic-speech-recognition", model="openai/whisper-base", device=device)
|
15 |
|
|
|
|
|
|
|
16 |
barkmodel = BarkModel.from_pretrained("suno/bark")
|
17 |
barkprocessor = BarkProcessor.from_pretrained("suno/bark")
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
def translate(audio):
|
21 |
outputs = asr_pipe(audio, max_new_tokens=256, generate_kwargs={"task": "transcribe", "language": "it"})
|