Update app.py
Browse filesChanging language to German. Changes in model, tokeniser and translate()
app.py
CHANGED
@@ -14,15 +14,15 @@ asr_pipe = pipeline("automatic-speech-recognition", model="openai/whisper-base",
|
|
14 |
# load text-to-speech checkpoint and speaker embeddings
|
15 |
#processor = SpeechT5Processor.from_pretrained("microsoft/speecht5_tts")
|
16 |
|
17 |
-
model = VitsModel.from_pretrained("Matthijs/mms-tts-
|
18 |
-
tokenizer = VitsTokenizer.from_pretrained("Matthijs/mms-tts-
|
19 |
|
20 |
#embeddings_dataset = load_dataset("Matthijs/cmu-arctic-xvectors", split="validation")
|
21 |
#speaker_embeddings = torch.tensor(embeddings_dataset[7306]["xvector"]).unsqueeze(0)
|
22 |
|
23 |
|
24 |
def translate(audio):
|
25 |
-
outputs = asr_pipe(audio, max_new_tokens=256, generate_kwargs={"task": "transcribe", "language": "
|
26 |
return outputs["text"]
|
27 |
|
28 |
|
@@ -49,7 +49,7 @@ def speech_to_speech_translation(audio):
|
|
49 |
|
50 |
title = "Cascaded STST"
|
51 |
description = """
|
52 |
-
Demo for cascaded speech-to-speech translation (STST), mapping from source speech in any language to target speech in
|
53 |
[SpeechT5 TTS](https://huggingface.co/microsoft/speecht5_tts) model for text-to-speech:
|
54 |
|
55 |

|
|
|
14 |
# load text-to-speech checkpoint and speaker embeddings
|
15 |
#processor = SpeechT5Processor.from_pretrained("microsoft/speecht5_tts")
|
16 |
|
17 |
+
model = VitsModel.from_pretrained("Matthijs/mms-tts-dae").to(device)
|
18 |
+
tokenizer = VitsTokenizer.from_pretrained("Matthijs/mms-tts-dae")
|
19 |
|
20 |
#embeddings_dataset = load_dataset("Matthijs/cmu-arctic-xvectors", split="validation")
|
21 |
#speaker_embeddings = torch.tensor(embeddings_dataset[7306]["xvector"]).unsqueeze(0)
|
22 |
|
23 |
|
24 |
def translate(audio):
|
25 |
+
outputs = asr_pipe(audio, max_new_tokens=256, generate_kwargs={"task": "transcribe", "language": "de"})
|
26 |
return outputs["text"]
|
27 |
|
28 |
|
|
|
49 |
|
50 |
title = "Cascaded STST"
|
51 |
description = """
|
52 |
+
Demo for cascaded speech-to-speech translation (STST), mapping from source speech in any language to target speech in German. Demo uses OpenAI's [Whisper Base](https://huggingface.co/openai/whisper-base) model for speech translation, and Microsoft's
|
53 |
[SpeechT5 TTS](https://huggingface.co/microsoft/speecht5_tts) model for text-to-speech:
|
54 |
|
55 |

|