smjain commited on
Commit
eb7e3d6
1 Parent(s): 573e272

Upload myinfer_latest.py

Browse files
Files changed (1) hide show
  1. myinfer_latest.py +11 -9
myinfer_latest.py CHANGED
@@ -197,7 +197,10 @@ def api_convert_voice():
197
  p.join()
198
  print("*******waiting for process to complete ")
199
  output_path = output_queue.get()
200
- print("output path of converted voice",output_path)
 
 
 
201
  #output_path = convert_voice(spk_id, vocal_path, voice_transform,unique_id)
202
  output_path1= combine_vocal_and_inst(output_path,inst,unique_id)
203
 
@@ -239,14 +242,13 @@ def get_processed_audio(audio_id):
239
  return jsonify({"error": "File not found."}), 404
240
 
241
  def worker(spk_id, input_audio_path, voice_transform, unique_id, output_queue):
242
- """
243
- Worker function to be executed in a separate process.
244
- """
245
- # Call the convert_voice function
246
- output_audio_path = convert_voice(spk_id, input_audio_path, voice_transform, unique_id)
247
- print("output in worker for audio file",output_audio_path)
248
- # Put the result in the queue to be retrieved by the main process
249
- output_queue.put(output_audio_path)
250
  def convert_voice(spk_id, input_audio_path, voice_transform,unique_id):
251
  get_vc(spk_id,0.5)
252
  print("*****before makinf call to vc ", unique_id)
 
197
  p.join()
198
  print("*******waiting for process to complete ")
199
  output_path = output_queue.get()
200
+ if isinstance(output_path, Exception):
201
+ print("Exception in worker:", output_path)
202
+ else:
203
+ print("output path of converted voice", output_path)
204
  #output_path = convert_voice(spk_id, vocal_path, voice_transform,unique_id)
205
  output_path1= combine_vocal_and_inst(output_path,inst,unique_id)
206
 
 
242
  return jsonify({"error": "File not found."}), 404
243
 
244
  def worker(spk_id, input_audio_path, voice_transform, unique_id, output_queue):
245
+ try:
246
+ output_audio_path = convert_voice(spk_id, input_audio_path, voice_transform, unique_id)
247
+ print("output in worker for audio file", output_audio_path)
248
+ output_queue.put(output_audio_path)
249
+ except Exception as e:
250
+ output_queue.put(e) # Send the exception to the main process for debugging
251
+
 
252
  def convert_voice(spk_id, input_audio_path, voice_transform,unique_id):
253
  get_vc(spk_id,0.5)
254
  print("*****before makinf call to vc ", unique_id)