Spaces:
Sleeping
Sleeping
Upload myinfer_latest.py
Browse files359 unmodified lines3603613623633643653663 unmodified lines37037137237337437518 unmodified lines3943953963973983994005 unmodified lines406407408409410411412359 unmodified linesthread_name = threading.current_thread().nameprint(f"Thread {thread_name}: Hash {hash_val}")save_audio_with_thread_id(audio_opt)sample_and_print(audio_opt,thread_name)# Print the hash and thread informationif resample_sr >= 16000 and tgt_sr != resample_sr:3 unmodified linesif os.path.exists(file_index)else "Index not used.")print("writing to FS")#output_file_path = os.path.join("output", f"converted_audio_{sid}.wav") # Adjust path as needed# Assuming 'unique_id' is passed to convert_voice function along with 'sid'18 unmodified linesreturn info, (None, None)def save_audio_with_thread_id(audio_opt, output_dir="output"):# Ensure the output directory existsos.makedirs(output_dir, exist_ok=True)5 unmodified linesoutput_path = os.path.join(output_dir, filename)# Assuming the target sample rate is defined elsewhere; replace as necessarytgt_sr = 16000 # Example sample rate, adjust according to your needs# Write the audio filesf.write(output_path, audio_opt, tgt_sr)359 unmodified lines3603613623633643653663 unmodified lines37037137237337437537618 unmodified lines3953963973983994004015 unmodified lines407408409410411412413359 unmodified linesthread_name = threading.current_thread().nameprint(f"Thread {thread_name}: Hash {hash_val}")sample_and_print(audio_opt,thread_name)# Print the hash and thread informationif resample_sr >= 16000 and tgt_sr != resample_sr:3 unmodified linesif os.path.exists(file_index)else "Index not used.")save_audio_with_thread_id(audio_opt,tgt_sr)print("writing to FS")#output_file_path = os.path.join("output", f"converted_audio_{sid}.wav") # Adjust path as needed# Assuming 'unique_id' is passed to convert_voice function along with 'sid'18 unmodified linesreturn info, (None, None)def save_audio_with_thread_id(audio_opt, output_dir="output",tgt_sr):# Ensure the output directory existsos.makedirs(output_dir, exist_ok=True)5 unmodified linesoutput_path = os.path.join(output_dir, filename)# Assuming the target sample rate is defined elsewhere; replace as necessary#tgt_sr = 16000 # Example sample rate, adjust according to your needs# Write the audio filesf.write(output_path, audio_opt, tgt_sr)
myinfer_latest.py+4-3