innnky commited on
Commit
a750793
1 Parent(s): 8ddfd6b
Files changed (2) hide show
  1. app.py +4 -3
  2. nyarumodel.pth +2 -2
app.py CHANGED
@@ -56,7 +56,7 @@ hubert = torch.hub.load("bshall/hubert:main", "hubert_soft")
56
 
57
  _ = utils.load_checkpoint("nyarumodel.pth", net_g_ms, None)
58
 
59
- def vc_fn(sid, input_audio,vc_transform):
60
  if input_audio is None:
61
  return "You need to upload an audio", None
62
  sampling_rate, audio = input_audio
@@ -84,7 +84,7 @@ def vc_fn(sid, input_audio,vc_transform):
84
  with torch.no_grad():
85
  x_tst = stn_tst.unsqueeze(0)
86
  x_tst_lengths = torch.LongTensor([stn_tst.size(0)])
87
- audio = net_g_ms.infer(x_tst, x_tst_lengths, pitch=pitch,sid=sid, noise_scale=0.4,
88
  noise_scale_w=0.1, length_scale=1)[0][0, 0].data.float().numpy()
89
  convert_cnt[0] += 1
90
  print(convert_cnt[0])
@@ -109,9 +109,10 @@ with app:
109
  sid = gr.Dropdown(label="音色",choices=['猫雷'], value="猫雷")
110
  vc_input3 = gr.Audio(label="上传音频(长度小于45秒)")
111
  vc_transform = gr.Number(label="变调(整数,可以正负,半音数量,升高八度就是12)",value=0)
 
112
  vc_submit = gr.Button("转换", variant="primary")
113
  vc_output1 = gr.Textbox(label="Output Message")
114
  vc_output2 = gr.Audio(label="Output Audio")
115
- vc_submit.click(vc_fn, [sid, vc_input3, vc_transform], [vc_output1, vc_output2])
116
 
117
  app.launch()
 
56
 
57
  _ = utils.load_checkpoint("nyarumodel.pth", net_g_ms, None)
58
 
59
+ def vc_fn(sid,random1, input_audio,vc_transform):
60
  if input_audio is None:
61
  return "You need to upload an audio", None
62
  sampling_rate, audio = input_audio
 
84
  with torch.no_grad():
85
  x_tst = stn_tst.unsqueeze(0)
86
  x_tst_lengths = torch.LongTensor([stn_tst.size(0)])
87
+ audio = net_g_ms.infer(x_tst, x_tst_lengths, pitch=pitch,sid=sid, noise_scale=float(random1),
88
  noise_scale_w=0.1, length_scale=1)[0][0, 0].data.float().numpy()
89
  convert_cnt[0] += 1
90
  print(convert_cnt[0])
 
109
  sid = gr.Dropdown(label="音色",choices=['猫雷'], value="猫雷")
110
  vc_input3 = gr.Audio(label="上传音频(长度小于45秒)")
111
  vc_transform = gr.Number(label="变调(整数,可以正负,半音数量,升高八度就是12)",value=0)
112
+ random1 = gr.Number(label="随机化程度,似乎会影响音质,建议保持默认",value=0.4)
113
  vc_submit = gr.Button("转换", variant="primary")
114
  vc_output1 = gr.Textbox(label="Output Message")
115
  vc_output2 = gr.Audio(label="Output Audio")
116
+ vc_submit.click(vc_fn, [sid,random1, vc_input3, vc_transform], [vc_output1, vc_output2])
117
 
118
  app.launch()
nyarumodel.pth CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:a14d75537894f6726e5b89e62a679986a0ef8bee52827f656fc57c333f668887
3
- size 256011087
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c489836c6519f7a3d1b98673a241a29a516834a642ca31c2c1bd9235c237b5c3
3
+ size 256010117