marigold334 commited on
Commit
c5fff6b
1 Parent(s): 5b2b713
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -16,7 +16,7 @@ class TTS:
16
  global device
17
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
18
  torch.cuda.manual_seed(1234) if torch.cuda.is_available() else None
19
- self.flowgenerator = Glow_model(n_vocab = 70, h_c= 192, f_c = 768, f_c_dp = 256, out_c = 80, k_s = 3, k_s_dec = 5, heads=2, layers_enc = 6).to(device)
20
  self.voicegenerator = GAN_model().to(device)
21
  if model_variant == '감기걸린 은식':
22
  name = '1038_eunsik_01'
@@ -41,8 +41,8 @@ class TTS:
41
  self.voicegenerator.remove_weight_norm()
42
 
43
  def inference(self, input_text, noise_scale = 0.667, length_scale = 1.0):
44
- filters = '([.,!?])'
45
- sentence = re.sub(re.compile(filters), '', input_text)
46
  x = text_to_sequence(sentence)
47
  x = torch.autograd.Variable(torch.tensor(x).unsqueeze(0)).to(device).long()
48
  x_length = torch.tensor(x.shape[1]).unsqueeze(0).to(device)
 
16
  global device
17
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
18
  torch.cuda.manual_seed(1234) if torch.cuda.is_available() else None
19
+ self.flowgenerator = Glow_model(n_vocab = 70 if model_variant != '태연' else 73, h_c= 192, f_c = 768, f_c_dp = 256, out_c = 80, k_s = 3, k_s_dec = 5, heads=2, layers_enc = 6).to(device)
20
  self.voicegenerator = GAN_model().to(device)
21
  if model_variant == '감기걸린 은식':
22
  name = '1038_eunsik_01'
 
41
  self.voicegenerator.remove_weight_norm()
42
 
43
  def inference(self, input_text, noise_scale = 0.667, length_scale = 1.0):
44
+ filters = '([.,!?])' if st.session_state != '태연' else '([,])'
45
+ sentence = re.sub(re.compile(filters), '', input_text)
46
  x = text_to_sequence(sentence)
47
  x = torch.autograd.Variable(torch.tensor(x).unsqueeze(0)).to(device).long()
48
  x_length = torch.tensor(x.shape[1]).unsqueeze(0).to(device)