Spaces:
Sleeping
Sleeping
Upload infer_serverless.py
Browse files307 unmodified lines30830931031131131231231331431531531631631731831932031832132232332 unmodified lines356357358357359360361362361362363364365366365367368369370307 unmodified lines ctx = get_context('spawn') output_queue = ctx.Queue() # Create and start the process worker(spk_id, vocal_path, voice_transform, unique_id) p = ctx.Process(target=worker, args=(spk_id, vocal_path, voice_transform, unique_id, output_queue,)) p.start() #p = ctx.Process(target=worker, args=(spk_id, vocal_path, voice_transform, unique_id, output_queue,)) #p.start() # Wait for the process to finish and get the result p.join() print("*******waiting for process to complete ") #p.join() #print("*******waiting for process to complete ") #output_path = output_queue.get() output_path = output_queue.get() task_status_tracker[unique_id] = {"status": "Processing: Step 2", "percentage": 80} #if isinstance(output_path, Exception): # print("Exception in worker:", output_path)32 unmodified lines
def worker(spk_id, input_audio_path, voice_transform, unique_id, output_queue):def worker(spk_id, input_audio_path, voice_transform, unique_id): try: output_audio_path = convert_voice(spk_id, input_audio_path, voice_transform, unique_id) print("output in worker for audio file", output_audio_path) output_queue.put(output_audio_path) print("added to output queue") #output_queue.put(output_audio_path) return output_audio_path except Exception as e: print("exception in adding to queue") output_queue.put(e) # Send the exception to the main process for debugging return "error in converting voice"
def convert_voice(spk_id, input_audio_path, voice_transform,unique_id):infer_serverless.py+11-9