Vinay15 commited on
Commit
d248bff
·
verified ·
1 Parent(s): e43ae25

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -3,8 +3,8 @@ import torch
3
  from datasets import load_dataset
4
  from transformers import SpeechT5Processor, SpeechT5HifiGan, SpeechT5ForTextToSpeech
5
 
6
- # Load the fine-tuned model and vocoder for Italian
7
- model_id = "Sandiago21/speecht5_finetuned_voxpopuli_it"
8
  model = SpeechT5ForTextToSpeech.from_pretrained(model_id)
9
  vocoder = SpeechT5HifiGan.from_pretrained("microsoft/speecht5_hifigan")
10
 
@@ -12,7 +12,7 @@ vocoder = SpeechT5HifiGan.from_pretrained("microsoft/speecht5_hifigan")
12
  embeddings_dataset = load_dataset("Matthijs/cmu-arctic-xvectors", split="validation")
13
  speaker_embeddings = torch.tensor(embeddings_dataset[7440]["xvector"]).unsqueeze(0)
14
 
15
- # Load processor for the Italian model
16
  processor = SpeechT5Processor.from_pretrained(model_id)
17
 
18
  # Optional: Text cleanup for Italian-specific characters
@@ -27,7 +27,7 @@ replacements = [
27
 
28
  # Text-to-speech synthesis function
29
  def synthesize_speech(text):
30
- # Clean up text
31
  for src, dst in replacements:
32
  text = text.replace(src, dst)
33
 
@@ -58,4 +58,4 @@ interface = gr.Interface(
58
  )
59
 
60
  # Launch the interface
61
- interface.launch()
 
3
  from datasets import load_dataset
4
  from transformers import SpeechT5Processor, SpeechT5HifiGan, SpeechT5ForTextToSpeech
5
 
6
+ # Load the fine-tuned model and vocoder for Italian from the new model ID
7
+ model_id = "Vinay15/speecht5_finetuned_voxpopuli_it"
8
  model = SpeechT5ForTextToSpeech.from_pretrained(model_id)
9
  vocoder = SpeechT5HifiGan.from_pretrained("microsoft/speecht5_hifigan")
10
 
 
12
  embeddings_dataset = load_dataset("Matthijs/cmu-arctic-xvectors", split="validation")
13
  speaker_embeddings = torch.tensor(embeddings_dataset[7440]["xvector"]).unsqueeze(0)
14
 
15
+ # Load processor for the new Italian model
16
  processor = SpeechT5Processor.from_pretrained(model_id)
17
 
18
  # Optional: Text cleanup for Italian-specific characters
 
27
 
28
  # Text-to-speech synthesis function
29
  def synthesize_speech(text):
30
+ # Clean up text for Italian-specific accents
31
  for src, dst in replacements:
32
  text = text.replace(src, dst)
33
 
 
58
  )
59
 
60
  # Launch the interface
61
+ interface.launch()