Plachta commited on
Commit
887727d
1 Parent(s): b2d8161

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -11,6 +11,10 @@ import numpy as np
11
  import os
12
  import translators.server as tss
13
  import psutil
 
 
 
 
14
  limitation = os.getenv("SYSTEM") == "spaces" # limit text and audio length in huggingface spaces
15
  max_len = 150
16
  languages = ['日本語', '简体中文', 'English']
@@ -76,7 +80,8 @@ def infer(text, character, language, duration, noise_scale, noise_scale_w):
76
  return "Error: Text is too long", None
77
  if text_len == 0:
78
  return "Error: Please input text!", None
79
- show_memory_info("infer调用前")
 
80
  if language == '日本語':
81
  pass
82
  elif language == '简体中文':
@@ -91,8 +96,8 @@ def infer(text, character, language, duration, noise_scale, noise_scale_w):
91
  sid = torch.LongTensor([char_id])
92
  audio = net_g.infer(x_tst, x_tst_lengths, sid=sid, noise_scale=noise_scale, noise_scale_w=noise_scale_w,
93
  length_scale=duration)[0][0, 0].data.cpu().float().numpy()
94
- del stn_tst, x_tst, x_tst_lengths, sid
95
- show_memory_info("infer调用后")
96
  return (text, (22050, audio))
97
 
98
  if __name__ == "__main__":
 
11
  import os
12
  import translators.server as tss
13
  import psutil
14
+ from datetime import datetime
15
+
16
+
17
+
18
  limitation = os.getenv("SYSTEM") == "spaces" # limit text and audio length in huggingface spaces
19
  max_len = 150
20
  languages = ['日本語', '简体中文', 'English']
 
80
  return "Error: Text is too long", None
81
  if text_len == 0:
82
  return "Error: Please input text!", None
83
+ currentDateAndTime = datetime.now()
84
+ show_memory_info(str(currentDateAndTime) + "infer调用前")
85
  if language == '日本語':
86
  pass
87
  elif language == '简体中文':
 
96
  sid = torch.LongTensor([char_id])
97
  audio = net_g.infer(x_tst, x_tst_lengths, sid=sid, noise_scale=noise_scale, noise_scale_w=noise_scale_w,
98
  length_scale=duration)[0][0, 0].data.cpu().float().numpy()
99
+ currentDateAndTime = datetime.now()
100
+ show_memory_info(str(currentDateAndTime) + "infer调用后")
101
  return (text, (22050, audio))
102
 
103
  if __name__ == "__main__":