zhuowen commited on
Commit
016322a
·
verified ·
1 Parent(s): 27ffa6a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -30
app.py CHANGED
@@ -67,40 +67,15 @@ if len(models) == 0:
67
  models.sort()
68
 
69
  def tts_new(text,path,voice='zh-CN-XiaoxiaoMultilingualNeural',rate=-8):
70
- url = "https://www.text-to-speech.cn/getSpeek.php"
71
 
72
  payload = {
73
- "user_id": str(random.randint(120100,2000000)),
74
- "language": "中文(普通话,简体)",
75
- "voice": voice,
76
- "text": text,
77
- "role": "0",
78
- "style": "0",
79
- "styledegree": "1",
80
- "volume": "75",
81
- "predict": "0",
82
- "rate": rate,
83
- "pitch": "0",
84
- "kbitrate": "audio-16khz-128kbitrate-mono-mp3",
85
- "silence": "",
86
- "yzm": "^\""
87
  }
88
- headers = {
89
- "Referer": "https://www.text-to-speech.cn/",
90
- "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 Edg/124.0.0.0",
91
- "accept": "*/*",
92
- "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
93
- "content-type": "application/x-www-form-urlencoded; charset=UTF-8",
94
- "origin": "https://www.text-to-speech.cn",
95
- "referer": "https://www.text-to-speech.cn/"
96
- }
97
-
98
- response = requests.post(url, data=payload, headers=headers)
99
- url=response.json()['download']
100
- print(response.json())
101
- mp3=requests.get(url)
102
  with open(path, "wb") as f:
103
- f.write(mp3.content)
104
 
105
  def model_data(model_name):
106
  # global n_spk, tgt_sr, net_g, vc, cpt, version, index_file
 
67
  models.sort()
68
 
69
  def tts_new(text,path,voice='zh-CN-XiaoxiaoMultilingualNeural',rate=-8):
70
+ url = "https://t.leftsite.cn/tts"
71
 
72
  payload = {
73
+ t:text,
74
+ v:voice
 
 
 
 
 
 
 
 
 
 
 
 
75
  }
76
+ response = requests.post(url, data=payload)
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  with open(path, "wb") as f:
78
+ f.write(response.content)
79
 
80
  def model_data(model_name):
81
  # global n_spk, tgt_sr, net_g, vc, cpt, version, index_file