Mahiruoshi commited on
Commit
506e073
·
1 Parent(s): 3e7715d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -228
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  logging.getLogger('numba').setLevel(logging.WARNING)
2
  logging.getLogger('matplotlib').setLevel(logging.WARNING)
3
  logging.getLogger('urllib3').setLevel(logging.WARNING)
@@ -5,6 +6,13 @@ import json
5
  import re
6
  import numpy as np
7
  import IPython.display as ipd
 
 
 
 
 
 
 
8
  import time
9
  import datetime
10
  import os
@@ -12,93 +20,6 @@ import pickle
12
  import openai
13
  from scipy.io.wavfile import write
14
  def is_japanese(string):
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
-
55
-
56
-
57
-
58
-
59
-
60
-
61
-
62
-
63
-
64
-
65
-
66
-
67
-
68
-
69
-
70
-
71
-
72
-
73
-
74
-
75
-
76
-
77
-
78
-
79
-
80
-
81
-
82
-
83
-
84
-
85
-
86
-
87
-
88
-
89
-
90
-
91
-
92
-
93
-
94
-
95
-
96
-
97
-
98
-
99
-
100
-
101
-
102
  for ch in string:
103
  if ord(ch) > 0x3040 and ord(ch) < 0x30FF:
104
  return True
@@ -112,11 +33,6 @@ def is_english(string):
112
  else:
113
  return False
114
 
115
-
116
-
117
-
118
-
119
-
120
  def to_html(chat_history):
121
  chat_html = ""
122
  for item in chat_history:
@@ -212,112 +128,7 @@ def get_symbols_from_json(path):
212
  return data['symbols']
213
 
214
  def sle(language,text):
215
- text = text.replace('\n', ' ').replace('\r', '').replace(" ", "")
216
-
217
-
218
-
219
-
220
-
221
-
222
-
223
-
224
-
225
-
226
-
227
-
228
-
229
-
230
-
231
-
232
-
233
-
234
-
235
-
236
-
237
-
238
-
239
-
240
-
241
-
242
-
243
-
244
-
245
-
246
-
247
-
248
-
249
-
250
-
251
-
252
-
253
-
254
-
255
-
256
-
257
-
258
-
259
-
260
-
261
-
262
-
263
-
264
-
265
-
266
-
267
-
268
-
269
-
270
-
271
-
272
-
273
-
274
-
275
-
276
-
277
-
278
-
279
-
280
-
281
-
282
-
283
-
284
-
285
-
286
-
287
-
288
-
289
-
290
-
291
-
292
-
293
-
294
-
295
-
296
-
297
-
298
-
299
-
300
-
301
-
302
-
303
-
304
-
305
-
306
-
307
-
308
-
309
-
310
-
311
-
312
-
313
-
314
-
315
-
316
-
317
-
318
-
319
-
320
-
321
  if language == "中文":
322
  tts_input1 = "[ZH]" + text + "[ZH]"
323
  return tts_input1
@@ -327,41 +138,14 @@ def sle(language,text):
327
  elif language == "日文":
328
  tts_input1 = "[JA]" + text + "[JA]"
329
  return tts_input1
 
 
 
330
  elif language == "手动":
331
  return text
332
 
333
 
334
 
335
-
336
-
337
-
338
-
339
-
340
-
341
-
342
-
343
-
344
-
345
-
346
-
347
-
348
-
349
-
350
-
351
-
352
-
353
-
354
-
355
-
356
-
357
-
358
-
359
-
360
-
361
-
362
-
363
-
364
-
365
  def get_text(text,hps_ms):
366
  text_norm = text_to_sequence(text,hps_ms.data.text_cleaners)
367
  if hps_ms.data.add_blank:
 
1
+ import logging
2
  logging.getLogger('numba').setLevel(logging.WARNING)
3
  logging.getLogger('matplotlib').setLevel(logging.WARNING)
4
  logging.getLogger('urllib3').setLevel(logging.WARNING)
 
6
  import re
7
  import numpy as np
8
  import IPython.display as ipd
9
+ import torch
10
+ import commons
11
+ import utils
12
+ from models import SynthesizerTrn
13
+ from text.symbols import symbols
14
+ from text import text_to_sequence
15
+ import gradio as gr
16
  import time
17
  import datetime
18
  import os
 
20
  import openai
21
  from scipy.io.wavfile import write
22
  def is_japanese(string):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  for ch in string:
24
  if ord(ch) > 0x3040 and ord(ch) < 0x30FF:
25
  return True
 
33
  else:
34
  return False
35
 
 
 
 
 
 
36
  def to_html(chat_history):
37
  chat_html = ""
38
  for item in chat_history:
 
128
  return data['symbols']
129
 
130
  def sle(language,text):
131
+ text = text.replace('\n', '').replace('\r', '').replace(" ", "")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
  if language == "中文":
133
  tts_input1 = "[ZH]" + text + "[ZH]"
134
  return tts_input1
 
138
  elif language == "日文":
139
  tts_input1 = "[JA]" + text + "[JA]"
140
  return tts_input1
141
+ elif language == "英文":
142
+ tts_input1 = "[EN]" + text + "[EN]"
143
+ return tts_input1
144
  elif language == "手动":
145
  return text
146
 
147
 
148
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149
  def get_text(text,hps_ms):
150
  text_norm = text_to_sequence(text,hps_ms.data.text_cleaners)
151
  if hps_ms.data.add_blank: