Spaces:
Sleeping
Sleeping
Upload infer_serverless.py
Browse files- infer_serverless.py +11 -9
infer_serverless.py
CHANGED
@@ -308,14 +308,16 @@ def api_convert_voice(filename,spk_id1,unique_id):
|
|
308 |
ctx = get_context('spawn')
|
309 |
output_queue = ctx.Queue()
|
310 |
# Create and start the process
|
311 |
-
|
312 |
-
p.
|
|
|
313 |
|
314 |
# Wait for the process to finish and get the result
|
315 |
-
p.join()
|
316 |
-
print("*******waiting for process to complete ")
|
|
|
|
|
317 |
|
318 |
-
output_path = output_queue.get()
|
319 |
task_status_tracker[unique_id] = {"status": "Processing: Step 2", "percentage": 80}
|
320 |
#if isinstance(output_path, Exception):
|
321 |
# print("Exception in worker:", output_path)
|
@@ -354,15 +356,15 @@ def get_vc_safe(sid, to_return_protect0):
|
|
354 |
|
355 |
|
356 |
|
357 |
-
def worker(spk_id, input_audio_path, voice_transform, unique_id
|
358 |
try:
|
359 |
output_audio_path = convert_voice(spk_id, input_audio_path, voice_transform, unique_id)
|
360 |
print("output in worker for audio file", output_audio_path)
|
361 |
-
output_queue.put(output_audio_path)
|
362 |
-
|
363 |
except Exception as e:
|
364 |
print("exception in adding to queue")
|
365 |
-
|
366 |
|
367 |
|
368 |
def convert_voice(spk_id, input_audio_path, voice_transform,unique_id):
|
|
|
308 |
ctx = get_context('spawn')
|
309 |
output_queue = ctx.Queue()
|
310 |
# Create and start the process
|
311 |
+
worker(spk_id, vocal_path, voice_transform, unique_id)
|
312 |
+
#p = ctx.Process(target=worker, args=(spk_id, vocal_path, voice_transform, unique_id, output_queue,))
|
313 |
+
#p.start()
|
314 |
|
315 |
# Wait for the process to finish and get the result
|
316 |
+
#p.join()
|
317 |
+
#print("*******waiting for process to complete ")
|
318 |
+
|
319 |
+
#output_path = output_queue.get()
|
320 |
|
|
|
321 |
task_status_tracker[unique_id] = {"status": "Processing: Step 2", "percentage": 80}
|
322 |
#if isinstance(output_path, Exception):
|
323 |
# print("Exception in worker:", output_path)
|
|
|
356 |
|
357 |
|
358 |
|
359 |
+
def worker(spk_id, input_audio_path, voice_transform, unique_id):
|
360 |
try:
|
361 |
output_audio_path = convert_voice(spk_id, input_audio_path, voice_transform, unique_id)
|
362 |
print("output in worker for audio file", output_audio_path)
|
363 |
+
#output_queue.put(output_audio_path)
|
364 |
+
return output_audio_path
|
365 |
except Exception as e:
|
366 |
print("exception in adding to queue")
|
367 |
+
return "error in converting voice"
|
368 |
|
369 |
|
370 |
def convert_voice(spk_id, input_audio_path, voice_transform,unique_id):
|