Spaces:
Runtime error
Runtime error
changed language to Vietnamese
Browse files
app.py
CHANGED
@@ -12,15 +12,15 @@ device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
|
12 |
asr_pipe = pipeline("automatic-speech-recognition", model="openai/whisper-base", device=device)
|
13 |
|
14 |
# load text-to-speech checkpoint and speaker embeddings
|
15 |
-
model = VitsModel.from_pretrained("facebook/mms-tts")
|
16 |
-
tokenizer = VitsTokenizer.from_pretrained("facebook/mms-tts")
|
17 |
|
18 |
embeddings_dataset = load_dataset("Matthijs/cmu-arctic-xvectors", split="validation")
|
19 |
speaker_embeddings = torch.tensor(embeddings_dataset[7306]["xvector"]).unsqueeze(0)
|
20 |
|
21 |
|
22 |
def translate(audio):
|
23 |
-
outputs = asr_pipe(audio, max_new_tokens=256, generate_kwargs={"task": "translate", "language": "
|
24 |
return outputs["text"]
|
25 |
|
26 |
|
@@ -40,7 +40,7 @@ def speech_to_speech_translation(audio):
|
|
40 |
|
41 |
title = "Cascaded STST"
|
42 |
description = """
|
43 |
-
Demo for cascaded speech-to-speech translation (STST), mapping from source speech in any language to target speech in
|
44 |
Demo uses OpenAI's [Whisper Base](https://huggingface.co/openai/whisper-base) model for speech translation, and Meta's [MMS TTS](https://huggingface.co/facebook/mms-tts-deu) model for text-to-speech:
|
45 |
|
46 |

|
|
|
12 |
asr_pipe = pipeline("automatic-speech-recognition", model="openai/whisper-base", device=device)
|
13 |
|
14 |
# load text-to-speech checkpoint and speaker embeddings
|
15 |
+
model = VitsModel.from_pretrained("facebook/mms-tts-vie")
|
16 |
+
tokenizer = VitsTokenizer.from_pretrained("facebook/mms-tts-vie")
|
17 |
|
18 |
embeddings_dataset = load_dataset("Matthijs/cmu-arctic-xvectors", split="validation")
|
19 |
speaker_embeddings = torch.tensor(embeddings_dataset[7306]["xvector"]).unsqueeze(0)
|
20 |
|
21 |
|
22 |
def translate(audio):
|
23 |
+
outputs = asr_pipe(audio, max_new_tokens=256, generate_kwargs={"task": "translate", "language": "vi"})
|
24 |
return outputs["text"]
|
25 |
|
26 |
|
|
|
40 |
|
41 |
title = "Cascaded STST"
|
42 |
description = """
|
43 |
+
Demo for cascaded speech-to-speech translation (STST), mapping from source speech in any language to target speech in Vietnamese.
|
44 |
Demo uses OpenAI's [Whisper Base](https://huggingface.co/openai/whisper-base) model for speech translation, and Meta's [MMS TTS](https://huggingface.co/facebook/mms-tts-deu) model for text-to-speech:
|
45 |
|
46 |

|