meguscx commited on
Commit
e51a42c
·
verified ·
1 Parent(s): cced02b

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +39 -0
README.md ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - th
5
+ ---
6
+ # My first TTS
7
+
8
+
9
+ ## Example
10
+
11
+ ```python
12
+ import torch
13
+ from transformers import VitsTokenizer, VitsModel, set_seed
14
+ import scipy.io.wavfile
15
+
16
+ device = "cuda" if torch.cuda.is_available() else "cpu"
17
+
18
+ model = VitsModel.from_pretrained("meguscx/VITS-TH-Model").to(device)
19
+ tokenizer = VitsTokenizer.from_pretrained("meguscx/VITS-TH-Model")
20
+
21
+ text = "การเรียนรู้ภาษาใหม่ช่วยเปิดโลกทัศน์ให้กว้างขึ้น"
22
+
23
+ inputs = tokenizer(text=text, return_tensors="pt").to(device)
24
+
25
+ set_seed(456)
26
+
27
+ with torch.no_grad():
28
+ outputs = model(**inputs)
29
+
30
+ waveform = outputs.waveform[0].cpu().numpy()
31
+
32
+ scipy.io.wavfile.write(
33
+ "test.wav",
34
+ rate=model.config.sampling_rate,
35
+ data=waveform
36
+ )
37
+
38
+ print("Saved successfully.")
39
+ ```