kevinwang676 commited on
Commit
e88316e
·
verified ·
1 Parent(s): ad592cf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -114,6 +114,7 @@ def download_online_model(url, dir_name):
114
  else:
115
  zip_path = get_file_name(url)
116
  if not os.path.exists(zip_path):
 
117
  try:
118
  zip_name = url.split('/')[-1]
119
  extraction_folder = os.path.join(zip_path, dir_name)
@@ -130,6 +131,8 @@ def download_online_model(url, dir_name):
130
 
131
  except Exception as e:
132
  raise Exception(str(e))
 
 
133
 
134
  #Get bilibili BV id
135
 
@@ -386,8 +389,6 @@ def rvc_models(model_name):
386
 
387
  singers="您的专属AI歌手阵容:"
388
 
389
-
390
-
391
  @spaces.GPU(duration=120)
392
  def rvc_infer_music_gpu(zip_path, song_name, song_id, split_model, f0_up_key, vocal_volume, inst_volume):
393
  print("3.开始加载HuBert模型...")
@@ -406,7 +407,7 @@ def rvc_infer_music_gpu(zip_path, song_name, song_id, split_model, f0_up_key, vo
406
  print("3.开始加载AI歌手模型参数...")
407
  rvc_models(zip_path)
408
  if os.path.isdir(f"./output/{split_model}/{song_id}")==True:
409
- print("4.直接开始推理")
410
  audio, sr = librosa.load(f"./output/{split_model}/{song_id}/vocal_{song_id}.wav_10.wav", sr=16000, mono=True)
411
  song_infer = vc.pipeline(
412
  hubert_model,
@@ -429,9 +430,9 @@ def rvc_infer_music_gpu(zip_path, song_name, song_id, split_model, f0_up_key, vo
429
  f0_file=None,
430
  )
431
  else:
432
- print("4.1.开始去除BGM")
433
  audio, sr = librosa.load(youtube_downloader(song_id, split_model)[0], sr=16000, mono=True)
434
- print("4.1.开始推理")
435
  song_infer = vc.pipeline(
436
  hubert_model,
437
  net_g,
 
114
  else:
115
  zip_path = get_file_name(url)
116
  if not os.path.exists(zip_path):
117
+ print("P.S. AI歌手模型还未下载")
118
  try:
119
  zip_name = url.split('/')[-1]
120
  extraction_folder = os.path.join(zip_path, dir_name)
 
131
 
132
  except Exception as e:
133
  raise Exception(str(e))
134
+ else:
135
+ print("P.S. AI歌手模型之前已经下载")
136
 
137
  #Get bilibili BV id
138
 
 
389
 
390
  singers="您的专属AI歌手阵容:"
391
 
 
 
392
  @spaces.GPU(duration=120)
393
  def rvc_infer_music_gpu(zip_path, song_name, song_id, split_model, f0_up_key, vocal_volume, inst_volume):
394
  print("3.开始加载HuBert模型...")
 
407
  print("3.开始加载AI歌手模型参数...")
408
  rvc_models(zip_path)
409
  if os.path.isdir(f"./output/{split_model}/{song_id}")==True:
410
+ print("4.直接开始推理(BGM之前已经去除)...")
411
  audio, sr = librosa.load(f"./output/{split_model}/{song_id}/vocal_{song_id}.wav_10.wav", sr=16000, mono=True)
412
  song_infer = vc.pipeline(
413
  hubert_model,
 
430
  f0_file=None,
431
  )
432
  else:
433
+ print("4.1.开始去除BGM...")
434
  audio, sr = librosa.load(youtube_downloader(song_id, split_model)[0], sr=16000, mono=True)
435
+ print("4.1.开始推理...")
436
  song_infer = vc.pipeline(
437
  hubert_model,
438
  net_g,