lorneluo commited on
Commit
a090989
1 Parent(s): 351457d

add uvr job

Browse files
Files changed (1) hide show
  1. inst.py +14 -0
inst.py CHANGED
@@ -5,6 +5,7 @@ from datetime import datetime
5
  from pathlib import Path
6
  from time import sleep
7
 
 
8
  from tqdm import tqdm
9
 
10
  from args import mdx23c_8kfft_instvoc_hq_process_data, htdemucs_ft_process_data, uvr_mdx_net_voc_ft_process_data
@@ -100,6 +101,19 @@ def ensemble(stem_outputs, stem_save_path, format=WAV):
100
  save_format(stem_save_path, format, '320k')
101
 
102
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  # /Users/taoluo/Downloads/test/kimk_audio_MDX23C-8KFFT-InstVoc_HQ_(Instrumental).WAV
104
  #
105
  if __name__ == '__main__':
 
5
  from pathlib import Path
6
  from time import sleep
7
 
8
+ import requests
9
  from tqdm import tqdm
10
 
11
  from args import mdx23c_8kfft_instvoc_hq_process_data, htdemucs_ft_process_data, uvr_mdx_net_voc_ft_process_data
 
101
  save_format(stem_save_path, format, '320k')
102
 
103
 
104
+ def uvr_job(song_id, platform='netease'):
105
+ audio_dir = os.getcwd()
106
+ audio_file = f'{song_id}.m4a' if platform == 'youtube' else f'{song_id}.mp3'
107
+ audio_path = os.path.join(audio_dir, audio_file)
108
+
109
+ url = f"http://or.luotao.net/api/download_song?song_id={song_id}&platform={platform}"
110
+ r = requests.get(url, allow_redirects=True)
111
+ open(audio_path, 'wb').write(r.content)
112
+
113
+ instrumental_path, vocals_path = run_ensemble_models(audio_file, audio_dir)
114
+ return instrumental_path
115
+
116
+
117
  # /Users/taoluo/Downloads/test/kimk_audio_MDX23C-8KFFT-InstVoc_HQ_(Instrumental).WAV
118
  #
119
  if __name__ == '__main__':