EDGAhab commited on
Commit
2d2fdc9
·
1 Parent(s): a18c90f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -6
app.py CHANGED
@@ -9,6 +9,17 @@ from models import SynthesizerTrn
9
  from text.symbols import symbols
10
  from text import text_to_sequence
11
 
 
 
 
 
 
 
 
 
 
 
 
12
  def get_text(text, hps):
13
  text_norm = text_to_sequence(text, hps.data.text_cleaners)
14
  if hps.data.add_blank:
@@ -16,7 +27,6 @@ def get_text(text, hps):
16
  text_norm = torch.LongTensor(text_norm)
17
  return text_norm
18
 
19
-
20
  hps = utils.get_hparams_from_file("configs/biaobei_base.json")
21
 
22
  net_g = SynthesizerTrn(
@@ -26,7 +36,6 @@ net_g = SynthesizerTrn(
26
  **hps.model)
27
  _ = net_g.eval()
28
 
29
- # _ = utils.load_checkpoint("logs/woman_csmsc/G_100000.pth", net_g, None)
30
  _ = utils.load_checkpoint("G_aatrox.pth", net_g, None)
31
 
32
  def vc_fn(input):
@@ -34,10 +43,6 @@ def vc_fn(input):
34
  with torch.no_grad():
35
  x_tst = stn_tst.unsqueeze(0)
36
  x_tst_lengths = torch.LongTensor([stn_tst.size(0)])
37
-
38
- # x_tst = stn_tst.cpu().unsqueeze(0)
39
- # x_tst_lengths = torch.LongTensor([stn_tst.size(0)]).cpu()
40
-
41
  audio = net_g.infer(x_tst, x_tst_lengths, noise_scale=.667, noise_scale_w=0.8, length_scale=1)[0][0,0].data.cpu().float().numpy()
42
  sampling_rate = 22050
43
  return (sampling_rate, audio)
 
9
  from text.symbols import symbols
10
  from text import text_to_sequence
11
 
12
+ %matplotlib inline
13
+ import matplotlib.pyplot as plt
14
+ import json
15
+ import math
16
+ from torch import nn
17
+ from torch.nn import functional as F
18
+ from torch.utils.data import DataLoader
19
+
20
+ from data_utils import TextAudioLoader, TextAudioCollate, TextAudioSpeakerLoader, TextAudioSpeakerCollate
21
+ from scipy.io.wavfile import write
22
+
23
  def get_text(text, hps):
24
  text_norm = text_to_sequence(text, hps.data.text_cleaners)
25
  if hps.data.add_blank:
 
27
  text_norm = torch.LongTensor(text_norm)
28
  return text_norm
29
 
 
30
  hps = utils.get_hparams_from_file("configs/biaobei_base.json")
31
 
32
  net_g = SynthesizerTrn(
 
36
  **hps.model)
37
  _ = net_g.eval()
38
 
 
39
  _ = utils.load_checkpoint("G_aatrox.pth", net_g, None)
40
 
41
  def vc_fn(input):
 
43
  with torch.no_grad():
44
  x_tst = stn_tst.unsqueeze(0)
45
  x_tst_lengths = torch.LongTensor([stn_tst.size(0)])
 
 
 
 
46
  audio = net_g.infer(x_tst, x_tst_lengths, noise_scale=.667, noise_scale_w=0.8, length_scale=1)[0][0,0].data.cpu().float().numpy()
47
  sampling_rate = 22050
48
  return (sampling_rate, audio)