Spaces:
Running
Running
Upload myinfer_latest.py
Browse files- myinfer_latest.py +16 -0
myinfer_latest.py
CHANGED
@@ -360,6 +360,8 @@ def vc_single(
|
|
360 |
thread_name = threading.current_thread().name
|
361 |
print(f"Thread {thread_name}: Hash {hash_val}")
|
362 |
|
|
|
|
|
363 |
# Print the hash and thread information
|
364 |
if resample_sr >= 16000 and tgt_sr != resample_sr:
|
365 |
tgt_sr = resample_sr
|
@@ -392,6 +394,20 @@ def vc_single(
|
|
392 |
|
393 |
return info, (None, None)
|
394 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
395 |
def get_vc(sid, to_return_protect0):
|
396 |
global n_spk, tgt_sr, net_g, vc, cpt, version, weights_index
|
397 |
if sid == "" or sid == []:
|
|
|
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:
|
367 |
tgt_sr = resample_sr
|
|
|
394 |
|
395 |
return info, (None, None)
|
396 |
|
397 |
+
def sample_and_print(array, thread_name):
|
398 |
+
# Ensure the array has more than 10 elements; otherwise, use the array length
|
399 |
+
num_samples = 10 if len(array) > 10 else len(array)
|
400 |
+
|
401 |
+
# Calculate indices to sample; spread them evenly across the array
|
402 |
+
indices = np.linspace(0, len(array) - 1, num=num_samples, dtype=int)
|
403 |
+
|
404 |
+
# Sample elements
|
405 |
+
sampled_elements = array[indices]
|
406 |
+
|
407 |
+
# Print sampled elements with thread ID
|
408 |
+
print(f"Thread {thread_name}: Sampled Elements: {sampled_elements}")
|
409 |
+
|
410 |
+
|
411 |
def get_vc(sid, to_return_protect0):
|
412 |
global n_spk, tgt_sr, net_g, vc, cpt, version, weights_index
|
413 |
if sid == "" or sid == []:
|