Update app.py
Browse files
app.py
CHANGED
@@ -10,7 +10,6 @@ device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
|
10 |
|
11 |
# load speech translation checkpoint
|
12 |
asr_pipe = pipeline("automatic-speech-recognition", model="openai/whisper-base", device=device)
|
13 |
-
forced_decoder_ids = processor.get_decoder_prompt_ids(language="spanish", task="translate")
|
14 |
|
15 |
|
16 |
# load text-to-speech checkpoint and speaker embeddings
|
@@ -27,6 +26,9 @@ def translate(audio):
|
|
27 |
outputs = asr_pipe(audio, max_new_tokens=256, generate_kwargs={"task": "translate"})
|
28 |
return outputs["text"]
|
29 |
|
|
|
|
|
|
|
30 |
|
31 |
def synthesise(text):
|
32 |
inputs = processor(text=text, return_tensors="pt")
|
|
|
10 |
|
11 |
# load speech translation checkpoint
|
12 |
asr_pipe = pipeline("automatic-speech-recognition", model="openai/whisper-base", device=device)
|
|
|
13 |
|
14 |
|
15 |
# load text-to-speech checkpoint and speaker embeddings
|
|
|
26 |
outputs = asr_pipe(audio, max_new_tokens=256, generate_kwargs={"task": "translate"})
|
27 |
return outputs["text"]
|
28 |
|
29 |
+
set:"transcribe""language"
|
30 |
+
generate_kwargs={"task": "transcribe", "language": "es"}
|
31 |
+
|
32 |
|
33 |
def synthesise(text):
|
34 |
inputs = processor(text=text, return_tensors="pt")
|