datasetsANDmodels commited on
Commit
15c05c2
·
verified ·
1 Parent(s): 8176a2c

Upload tts.py

Browse files
Files changed (1) hide show
  1. tts.py +28 -0
tts.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ##tts --text "ciao pluto" --model_path "glowtts-female-it/best_model.pth.tar" --config_path "glowtts-female-it/config.json"
2
+
3
+ import sys
4
+ from TTS.config import load_config
5
+ from TTS.utils.manage import ModelManager
6
+ from TTS.utils.synthesizer import Synthesizer
7
+
8
+ config="config.json"
9
+ model="best_model.pth.tar"
10
+
11
+ synthesizer = Synthesizer(
12
+ model, config
13
+ )
14
+ text="È anche un noto pittore e paesaggista greco e conosce trecento opere da collezione."
15
+ wavs = synthesizer.tts(text)
16
+ synthesizer.save_wav(wavs,'italian.wav')
17
+
18
+ i=0
19
+
20
+ '''
21
+ with open(sys.argv[1], 'r', encoding='utf-8') as file:
22
+ for line in file:
23
+ text = line.strip()
24
+ synthesizer.save_wav(wavs,str(i)+'.wav')
25
+ print ("tts --text '"+text+"' --model_path best_model.pth.tar --config_path config.json --out_path "+str(i)+".wav")
26
+ i=i+1
27
+
28
+ '''