Sandiago21 commited on
Commit
3e69892
·
1 Parent(s): d8eb0f3

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -11,15 +11,14 @@ device = "cuda:0" if torch.cuda.is_available() else "cpu"
11
  asr_pipe = pipeline("automatic-speech-recognition", model="openai/whisper-large-v2", device=device)
12
 
13
  # load text-to-speech checkpoint and speaker embeddings
14
- model_id = "Sandiago21/speecht5_finetuned_voxpopuli_it" # update with your model id
15
  # pipe = pipeline("automatic-speech-recognition", model=model_id)
16
  model = SpeechT5ForTextToSpeech.from_pretrained(model_id)
17
  vocoder = SpeechT5HifiGan.from_pretrained("microsoft/speecht5_hifigan")
18
  embeddings_dataset = load_dataset("Matthijs/cmu-arctic-xvectors", split="validation")
19
  speaker_embeddings = torch.tensor(embeddings_dataset[7440]["xvector"]).unsqueeze(0)
20
 
21
- checkpoint = "microsoft/speecht5_tts"
22
- processor = SpeechT5Processor.from_pretrained(checkpoint)
23
 
24
  replacements = [
25
  ("ου", "u"),
@@ -97,6 +96,10 @@ replacements = [
97
  ("ό", "o"),
98
  ("ύ", "i"),
99
  ("ώ", "o"),
 
 
 
 
100
  ]
101
 
102
  def cleanup_text(text):
@@ -132,8 +135,8 @@ def speech_to_speech_translation(audio):
132
 
133
  title = "Cascaded STST"
134
  description = """
135
- Demo for cascaded speech-to-speech translation (STST), mapping from source speech in any language to target speech in Italian. Demo uses OpenAI's [Whisper Large v2](https://huggingface.co/openai/whisper-large-v2) model for speech translation, and [Sandiago21/speecht5_finetuned_voxpopuli_it](https://huggingface.co/Sandiago21/speecht5_finetuned_voxpopuli_it) checkpoint for text-to-speech, which is based on Microsoft's
136
- [SpeechT5 TTS](https://huggingface.co/microsoft/speecht5_tts) model for text-to-speech, fine-tuned in Italian Audio dataset:
137
  ![Cascaded STST](https://huggingface.co/datasets/huggingface-course/audio-course-images/resolve/main/s2st_cascaded.png "Diagram of cascaded speech to speech translation")
138
  """
139
 
 
11
  asr_pipe = pipeline("automatic-speech-recognition", model="openai/whisper-large-v2", device=device)
12
 
13
  # load text-to-speech checkpoint and speaker embeddings
14
+ model_id = "Sandiago21/speecht5_finetuned_google_fleurs_greek" # update with your model id
15
  # pipe = pipeline("automatic-speech-recognition", model=model_id)
16
  model = SpeechT5ForTextToSpeech.from_pretrained(model_id)
17
  vocoder = SpeechT5HifiGan.from_pretrained("microsoft/speecht5_hifigan")
18
  embeddings_dataset = load_dataset("Matthijs/cmu-arctic-xvectors", split="validation")
19
  speaker_embeddings = torch.tensor(embeddings_dataset[7440]["xvector"]).unsqueeze(0)
20
 
21
+ processor = SpeechT5Processor.from_pretrained(model_id)
 
22
 
23
  replacements = [
24
  ("ου", "u"),
 
96
  ("ό", "o"),
97
  ("ύ", "i"),
98
  ("ώ", "o"),
99
+ ("í", "i"),
100
+ ("õ", "o"),
101
+ ("Ε", "E"),
102
+ ("Ψ", "Ps"),
103
  ]
104
 
105
  def cleanup_text(text):
 
135
 
136
  title = "Cascaded STST"
137
  description = """
138
+ Demo for cascaded speech-to-speech translation (STST), mapping from source speech in any language to target speech in Greek. Demo uses OpenAI's [Whisper Large v2](https://huggingface.co/openai/whisper-large-v2) model for speech translation, and [Sandiago21/speecht5_finetuned_google_fleurs_greek](https://huggingface.co/Sandiago21/speecht5_finetuned_google_fleurs_greek) checkpoint for text-to-speech, which is based on Microsoft's
139
+ [SpeechT5 TTS](https://huggingface.co/microsoft/speecht5_tts) model for text-to-speech, fine-tuned in Greek Audio dataset:
140
  ![Cascaded STST](https://huggingface.co/datasets/huggingface-course/audio-course-images/resolve/main/s2st_cascaded.png "Diagram of cascaded speech to speech translation")
141
  """
142