CarlDennis commited on
Commit
9b61580
·
1 Parent(s): 69768d3

Delete client request.py

Browse files
Files changed (1) hide show
  1. client request.py +0 -51
client request.py DELETED
@@ -1,51 +0,0 @@
1
- from urllib import request
2
- import json
3
- import sys
4
- import io
5
-
6
- sys.stdout = io.TextIOWrapper(sys.stdout.buffer,encoding='utf8')
7
-
8
- if __name__ == "__main__":
9
- url = "https://32d343o770.wicp.vip/tts"
10
- lan = {"中文":0,
11
- "日文":1,
12
- "英文":2,
13
- "德文":3,
14
- "克罗地亚文":4
15
- }
16
- idols ={"南小鸟":0,
17
- "园田海未":1,
18
- "小泉花阳":2,
19
- "星空凛":3,
20
- "东条希":4,
21
- "矢泽妮可":5,
22
- "绚濑绘里":6,
23
- "西木野真姬":7,
24
- "高坂穗乃果":8}
25
- headers ={
26
- "content-type": "application/json"}
27
- while True:
28
- input_sig = input('输入1进入云端文字转语音程序,输入其他字符退出程序')
29
- if not input_sig == "1":
30
- break
31
- input_language = input('请选择语言,请输入“中文”或“日文”或“英文”或“德文”或“克罗地亚文”,不要加双引号:')
32
- input_speaker_id = input('请选择说话人“请输入“南小鸟”或“园田海未”或“绚濑绘里”,不要加双引号:')
33
- input_noise_rate = input('请填写噪音比例,数值范围是0.1-1:')
34
- input_noise_deviation = input('请填写噪音偏差,数值范围是0.1-1:')
35
- input_length_scale = input('请填写倍速,这是一个数值:')
36
- input_text = input('请输入需要转语音的文本,不要加双引号:')
37
- v_dict = {
38
- 'lan': lan.get(input_language),
39
- 'spk': idols.get(input_speaker_id),
40
- "noise_rate": float(input_noise_rate),
41
- 'noise_deviation': float(input_noise_deviation),
42
- 'speed': float(input_length_scale),
43
- 'text': str(input_text)
44
- }
45
- req = request.Request(url=url,
46
- headers=headers,
47
- data=json.dumps(v_dict).encode("utf-8"))
48
-
49
- reps = request.urlopen(req).read()
50
- with open(f"{input_text}+{input_speaker_id}.wav", "wb") as f:
51
- f.write(reps)