jjsprockel commited on
Commit
c7ec150
1 Parent(s): bed853e

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +19 -0
README.md CHANGED
@@ -26,6 +26,25 @@ This model do text to speeche task in italian language
26
  ## Intended uses & limitations
27
 
28
  More information needed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
 
30
  ## Training and evaluation data
31
 
 
26
  ## Intended uses & limitations
27
 
28
  More information needed
29
+ Example:
30
+
31
+
32
+ from transformers import AutoProcessor, SpeechT5ForTextToSpeech
33
+
34
+ processor = AutoProcessor.from_pretrained("jjsprockel/speecht5_finetuned_voxpopuli_it")
35
+ model = SpeechT5ForTextToSpeech.from_pretrained("jjsprockel/speecht5_finetuned_voxpopuli_it")
36
+
37
+ speaker_embeddings = torch.tensor(example["speaker_embeddings"]).unsqueeze(0)
38
+
39
+ text = "Quando pensi che sarà possibile viaggiare?"
40
+ inputs = processor(text=text, return_tensors="pt")
41
+
42
+ vocoder = SpeechT5HifiGan.from_pretrained("microsoft/speecht5_hifigan")
43
+ speech = model.generate_speech(inputs["input_ids"], speaker_embeddings, vocoder=vocoder)
44
+
45
+ from IPython.display import Audio
46
+ Audio(speech.numpy(), rate=16000)
47
+
48
 
49
  ## Training and evaluation data
50