aoliveira commited on
Commit
56154ec
1 Parent(s): 76f3218

Update app.py

Browse files

changed to french

Files changed (1) hide show
  1. app.py +5 -5
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("sanchit-gandhi/speecht5_tts_vox_nl")
18
  #model = SpeechT5ForTextToSpeech.from_pretrained("aoliveira/speecht5_finetuned_voxpopuli_sk").to(device)
19
- model = SpeechT5ForTextToSpeech.from_pretrained("sanchit-gandhi/speecht5_tts_vox_nl").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,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": "nl"})
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 Dutch. 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 Dutch 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
  """
 
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
  """