Spaces:
Sleeping
Sleeping
Upload myinfer_latest.py
Browse files- myinfer_latest.py +4 -3
myinfer_latest.py
CHANGED
|
@@ -360,7 +360,7 @@ def vc_single(
|
|
| 360 |
thread_name = threading.current_thread().name
|
| 361 |
print(f"Thread {thread_name}: Hash {hash_val}")
|
| 362 |
|
| 363 |
-
|
| 364 |
sample_and_print(audio_opt,thread_name)
|
| 365 |
# Print the hash and thread information
|
| 366 |
if resample_sr >= 16000 and tgt_sr != resample_sr:
|
|
@@ -370,6 +370,7 @@ def vc_single(
|
|
| 370 |
if os.path.exists(file_index)
|
| 371 |
else "Index not used."
|
| 372 |
)
|
|
|
|
| 373 |
print("writing to FS")
|
| 374 |
#output_file_path = os.path.join("output", f"converted_audio_{sid}.wav") # Adjust path as needed
|
| 375 |
# Assuming 'unique_id' is passed to convert_voice function along with 'sid'
|
|
@@ -394,7 +395,7 @@ def vc_single(
|
|
| 394 |
|
| 395 |
return info, (None, None)
|
| 396 |
|
| 397 |
-
def save_audio_with_thread_id(audio_opt, output_dir="output"):
|
| 398 |
# Ensure the output directory exists
|
| 399 |
os.makedirs(output_dir, exist_ok=True)
|
| 400 |
|
|
@@ -406,7 +407,7 @@ def save_audio_with_thread_id(audio_opt, output_dir="output"):
|
|
| 406 |
output_path = os.path.join(output_dir, filename)
|
| 407 |
|
| 408 |
# Assuming the target sample rate is defined elsewhere; replace as necessary
|
| 409 |
-
tgt_sr = 16000 # Example sample rate, adjust according to your needs
|
| 410 |
|
| 411 |
# Write the audio file
|
| 412 |
sf.write(output_path, audio_opt, tgt_sr)
|
|
|
|
| 360 |
thread_name = threading.current_thread().name
|
| 361 |
print(f"Thread {thread_name}: Hash {hash_val}")
|
| 362 |
|
| 363 |
+
|
| 364 |
sample_and_print(audio_opt,thread_name)
|
| 365 |
# Print the hash and thread information
|
| 366 |
if resample_sr >= 16000 and tgt_sr != resample_sr:
|
|
|
|
| 370 |
if os.path.exists(file_index)
|
| 371 |
else "Index not used."
|
| 372 |
)
|
| 373 |
+
save_audio_with_thread_id(audio_opt,tgt_sr)
|
| 374 |
print("writing to FS")
|
| 375 |
#output_file_path = os.path.join("output", f"converted_audio_{sid}.wav") # Adjust path as needed
|
| 376 |
# Assuming 'unique_id' is passed to convert_voice function along with 'sid'
|
|
|
|
| 395 |
|
| 396 |
return info, (None, None)
|
| 397 |
|
| 398 |
+
def save_audio_with_thread_id(audio_opt, output_dir="output",tgt_sr):
|
| 399 |
# Ensure the output directory exists
|
| 400 |
os.makedirs(output_dir, exist_ok=True)
|
| 401 |
|
|
|
|
| 407 |
output_path = os.path.join(output_dir, filename)
|
| 408 |
|
| 409 |
# Assuming the target sample rate is defined elsewhere; replace as necessary
|
| 410 |
+
#tgt_sr = 16000 # Example sample rate, adjust according to your needs
|
| 411 |
|
| 412 |
# Write the audio file
|
| 413 |
sf.write(output_path, audio_opt, tgt_sr)
|