kevinwang676 commited on
Commit
5dc9375
1 Parent(s): a3e89d6

Update app_colab.py

Browse files
Files changed (1) hide show
  1. app_colab.py +8 -4
app_colab.py CHANGED
@@ -215,15 +215,19 @@ def youtube_downloader_100s(
215
 
216
  def convert(start_time, song_name_src, song_name_ref, ref_audio, check_song, auto_key, key_shift, vocal_vol, inst_vol):
217
  split_model = "UVR-HP5"
218
- song_name_ref = song_name_ref.strip().replace(" ", "")
219
- video_identifier = search_bilibili(song_name_ref)
220
- song_id = get_bilibili_video_id(video_identifier)
221
 
222
  song_name_src = song_name_src.strip().replace(" ", "")
223
  video_identifier_src = search_bilibili(song_name_src)
224
  song_id_src = get_bilibili_video_id(video_identifier_src)
225
 
226
  if ref_audio is None:
 
 
 
 
227
  if os.path.isdir(f"./output/{split_model}/{song_id}")==False:
228
  audio, sr = librosa.load(youtube_downloader_100s(video_identifier, song_id, split_model)[0], sr=24000, mono=True)
229
  soundfile.write("audio_ref.wav", audio, sr)
@@ -301,7 +305,7 @@ with app:
301
  inp7 = gr.Slider(minimum=-3, maximum=3, value=0, step=1, label="调节伴奏音量,默认为0")
302
  btn = gr.Button("一键开启AI翻唱之旅吧💕", variant="primary")
303
  with gr.Column():
304
- ref_audio = gr.Audio(label="您也可以选择从本地上传一段音色参考音频", info="需要为去除伴奏后的音频,建议上传长度为60~90s左右的.wav文件;如果您希望通过歌曲名自动提取参考音频,请勿在此上传音频文件", type="filepath", interactive=True)
305
  out = gr.Audio(label="AI歌手为您倾情演唱的歌曲", type="filepath", interactive=False)
306
 
307
  btn.click(convert, [inp0, inp1, inp2, ref_audio, inp3, inp4, inp5, inp6, inp7], out)
 
215
 
216
  def convert(start_time, song_name_src, song_name_ref, ref_audio, check_song, auto_key, key_shift, vocal_vol, inst_vol):
217
  split_model = "UVR-HP5"
218
+ #song_name_ref = song_name_ref.strip().replace(" ", "")
219
+ #video_identifier = search_bilibili(song_name_ref)
220
+ #song_id = get_bilibili_video_id(video_identifier)
221
 
222
  song_name_src = song_name_src.strip().replace(" ", "")
223
  video_identifier_src = search_bilibili(song_name_src)
224
  song_id_src = get_bilibili_video_id(video_identifier_src)
225
 
226
  if ref_audio is None:
227
+ song_name_ref = song_name_ref.strip().replace(" ", "")
228
+ video_identifier = search_bilibili(song_name_ref)
229
+ song_id = get_bilibili_video_id(video_identifier)
230
+
231
  if os.path.isdir(f"./output/{split_model}/{song_id}")==False:
232
  audio, sr = librosa.load(youtube_downloader_100s(video_identifier, song_id, split_model)[0], sr=24000, mono=True)
233
  soundfile.write("audio_ref.wav", audio, sr)
 
305
  inp7 = gr.Slider(minimum=-3, maximum=3, value=0, step=1, label="调节伴奏音量,默认为0")
306
  btn = gr.Button("一键开启AI翻唱之旅吧💕", variant="primary")
307
  with gr.Column():
308
+ ref_audio = gr.Audio(label="您也可以选择从本地上传一段音色参考音频。需要为去除伴奏后的音频,建议上传长度为60~90s左右的.wav文件;如果您希望通过歌曲名自动提取参考音频,请勿在此上传音频文件", type="filepath", interactive=True)
309
  out = gr.Audio(label="AI歌手为您倾情演唱的歌曲", type="filepath", interactive=False)
310
 
311
  btn.click(convert, [inp0, inp1, inp2, ref_audio, inp3, inp4, inp5, inp6, inp7], out)