Spaces:
Sleeping
Sleeping
Upload myinfer_latest.py
Browse files359 unmodified lines3603613623633633643653663 unmodified lines37037137237337437537618 unmodified lines3953963973973983994004015 unmodified lines407408409409410411412413359 unmodified lines thread_name = threading.current_thread().name print(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 information if resample_sr >= 16000 and tgt_sr != resample_sr:3 unmodified lines if 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 lines return info, (None, None)
def save_audio_with_thread_id(audio_opt, output_dir="output"):def save_audio_with_thread_id(audio_opt, output_dir="output",tgt_sr): # Ensure the output directory exists os.makedirs(output_dir, exist_ok=True) 5 unmodified lines output_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 #tgt_sr = 16000 # Example sample rate, adjust according to your needs # Write the audio file sf.write(output_path, audio_opt, tgt_sr)myinfer_latest.py+4-3