Spaces:
Runtime error
Runtime error
Update app.py
Browse fileschanged to french
app.py
CHANGED
@@ -14,9 +14,9 @@ asr_pipe = pipeline("automatic-speech-recognition", model="openai/whisper-base",
|
|
14 |
|
15 |
# load text-to-speech checkpoint and speaker embeddings
|
16 |
#processor = SpeechT5Processor.from_pretrained("microsoft/speecht5_tts")
|
17 |
-
processor = SpeechT5Processor.from_pretrained("
|
18 |
#model = SpeechT5ForTextToSpeech.from_pretrained("aoliveira/speecht5_finetuned_voxpopuli_sk").to(device)
|
19 |
-
model = SpeechT5ForTextToSpeech.from_pretrained("
|
20 |
vocoder = SpeechT5HifiGan.from_pretrained("microsoft/speecht5_hifigan").to(device)
|
21 |
|
22 |
embeddings_dataset = load_dataset("Matthijs/cmu-arctic-xvectors", split="validation")
|
@@ -24,7 +24,7 @@ speaker_embeddings = torch.tensor(embeddings_dataset[7306]["xvector"]).unsqueeze
|
|
24 |
|
25 |
|
26 |
def translate(audio):
|
27 |
-
outputs = asr_pipe(audio, max_new_tokens=256, generate_kwargs={"task": "transcribe", "language": "
|
28 |
return outputs["text"]
|
29 |
|
30 |
|
@@ -43,8 +43,8 @@ def speech_to_speech_translation(audio):
|
|
43 |
|
44 |
title = "Cascaded STST"
|
45 |
description = """
|
46 |
-
Demo for cascaded speech-to-speech translation (STST), mapping from source speech in any language to target speech in
|
47 |
-
SpeechT5 TTS model fine tuned for the
|
48 |
|
49 |
![Cascaded STST](https://huggingface.co/datasets/huggingface-course/audio-course-images/resolve/main/s2st_cascaded.png "Diagram of cascaded speech to speech translation")
|
50 |
"""
|
|
|
14 |
|
15 |
# load text-to-speech checkpoint and speaker embeddings
|
16 |
#processor = SpeechT5Processor.from_pretrained("microsoft/speecht5_tts")
|
17 |
+
processor = SpeechT5Processor.from_pretrained("Apocalypse-19/speecht5_finetuned_french")
|
18 |
#model = SpeechT5ForTextToSpeech.from_pretrained("aoliveira/speecht5_finetuned_voxpopuli_sk").to(device)
|
19 |
+
model = SpeechT5ForTextToSpeech.from_pretrained("Apocalypse-19/speecht5_finetuned_french").to(device)
|
20 |
vocoder = SpeechT5HifiGan.from_pretrained("microsoft/speecht5_hifigan").to(device)
|
21 |
|
22 |
embeddings_dataset = load_dataset("Matthijs/cmu-arctic-xvectors", split="validation")
|
|
|
24 |
|
25 |
|
26 |
def translate(audio):
|
27 |
+
outputs = asr_pipe(audio, max_new_tokens=256, generate_kwargs={"task": "transcribe", "language": "fr"})
|
28 |
return outputs["text"]
|
29 |
|
30 |
|
|
|
43 |
|
44 |
title = "Cascaded STST"
|
45 |
description = """
|
46 |
+
Demo for cascaded speech-to-speech translation (STST), mapping from source speech in any language to target speech in French. Demo uses OpenAI's [Whisper Base](https://huggingface.co/openai/whisper-base) model for speech translation, and Microsoft's
|
47 |
+
SpeechT5 TTS model fine tuned for the French language for text-to-speech:
|
48 |
|
49 |
![Cascaded STST](https://huggingface.co/datasets/huggingface-course/audio-course-images/resolve/main/s2st_cascaded.png "Diagram of cascaded speech to speech translation")
|
50 |
"""
|