fantasyfish commited on
Commit
a2a7890
·
1 Parent(s): c3feba5

Fix file naming bug in inference server script

Browse files
inference_server/server.py CHANGED
@@ -9,7 +9,7 @@ sudo docker run --gpus all --runtime=nvidia --rm \
9
  -it rvc:v0
10
  curl -X GET http://localhost:8081/inference \
11
  -H 'Content-Type: application/json' \
12
- -d '{"expName":"drake-200","audioFileName":"radwimps.mp3", "pitchShift": 0}'
13
  '''
14
  import json
15
  import os
@@ -37,15 +37,10 @@ def inference():
37
  exp_name = content['expName']
38
  audio_file_name = content['audioFileName']
39
  pitch_shift = content['pitchShift']
40
-
 
41
  model_path = exp_name + '.pth'
42
- index_path_list = glob("/third_party/RVC/logs/{}/added_IVF*_Flat_nprobe_1.index".format(exp_name))
43
- assert(len(index_path_list) == 1), "Index file not found"
44
- index_path = index_path_list[0]
45
  audio_path = os.path.join('/inputDir', audio_file_name)
46
- save_path = os.path.join('/outputDir', "{}_{}.wav".format(audio_file_name, exp_name))
47
- error_log_path = os.path.join("/logs{}.log".format(exp_name))
48
-
49
  if not os.path.exists('/third_party/RVC/weights/{}'.format(model_path)):
50
  exception("Model doesn't exist")
51
  return json.dumps({"message":"Model doesn't exist"}), 404
@@ -53,6 +48,12 @@ def inference():
53
  exception("Audio file doesn't exist")
54
  return json.dumps({"message":"Audio file doesn't exist"}), 404
55
 
 
 
 
 
 
 
56
  start_time = time.time()
57
  model_inference_single(model_path, index_path, audio_path, save_path, error_log_path, pitch_shift)
58
  end_time = time.time()
 
9
  -it rvc:v0
10
  curl -X GET http://localhost:8081/inference \
11
  -H 'Content-Type: application/json' \
12
+ -d '{"expName":"drake-20","audioFileName":"radwimps.mp3", "pitchShift": 0, "saveFileName":"radwimps_drake-20.wav"}'
13
  '''
14
  import json
15
  import os
 
37
  exp_name = content['expName']
38
  audio_file_name = content['audioFileName']
39
  pitch_shift = content['pitchShift']
40
+ save_file_name = content['saveFileName']
41
+
42
  model_path = exp_name + '.pth'
 
 
 
43
  audio_path = os.path.join('/inputDir', audio_file_name)
 
 
 
44
  if not os.path.exists('/third_party/RVC/weights/{}'.format(model_path)):
45
  exception("Model doesn't exist")
46
  return json.dumps({"message":"Model doesn't exist"}), 404
 
48
  exception("Audio file doesn't exist")
49
  return json.dumps({"message":"Audio file doesn't exist"}), 404
50
 
51
+ save_path = os.path.join('/outputDir', save_file_name)
52
+ error_log_path = os.path.join("/logs{}.log".format(exp_name))
53
+ index_path_list = glob("/third_party/RVC/logs/{}/added_IVF*_Flat_nprobe_1_v1.index".format(exp_name))
54
+ assert(len(index_path_list) == 1), "Index file not found"
55
+ index_path = index_path_list[0]
56
+
57
  start_time = time.time()
58
  model_inference_single(model_path, index_path, audio_path, save_path, error_log_path, pitch_shift)
59
  end_time = time.time()
results/{radwimps.mp3_drake-200.wav → radwimps_drake-200.wav} RENAMED
File without changes