Spaces:
Running
Running
Upload myinfer_latest.py
Browse files- myinfer_latest.py +19 -0
myinfer_latest.py
CHANGED
@@ -17,6 +17,8 @@ from mega import Mega
|
|
17 |
from flask import Flask, request, jsonify, send_file,session,render_template
|
18 |
import base64
|
19 |
import tempfile
|
|
|
|
|
20 |
import os
|
21 |
import werkzeug
|
22 |
from pydub import AudioSegment
|
@@ -65,6 +67,16 @@ hubert_model = None
|
|
65 |
f0method_mode = ["pm", "harvest", "crepe"]
|
66 |
f0method_info = "PM is fast, Harvest is good but extremely slow, and Crepe effect is good but requires GPU (Default: PM)"
|
67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
if os.path.isfile("rmvpe.pt"):
|
69 |
f0method_mode.insert(2, "rmvpe")
|
70 |
f0method_info = "PM is fast, Harvest is good but extremely slow, Rvmpe is alternative to harvest (might be better), and Crepe effect is good but requires GPU (Default: PM)"
|
@@ -339,6 +351,13 @@ def vc_single(
|
|
339 |
protect,
|
340 |
f0_file=f0_file
|
341 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
342 |
if resample_sr >= 16000 and tgt_sr != resample_sr:
|
343 |
tgt_sr = resample_sr
|
344 |
index_info = (
|
|
|
17 |
from flask import Flask, request, jsonify, send_file,session,render_template
|
18 |
import base64
|
19 |
import tempfile
|
20 |
+
import threading
|
21 |
+
import hashlib
|
22 |
import os
|
23 |
import werkzeug
|
24 |
from pydub import AudioSegment
|
|
|
67 |
f0method_mode = ["pm", "harvest", "crepe"]
|
68 |
f0method_info = "PM is fast, Harvest is good but extremely slow, and Crepe effect is good but requires GPU (Default: PM)"
|
69 |
|
70 |
+
def hash_array(array):
|
71 |
+
# Ensure the array is in a consistent byte format
|
72 |
+
array_bytes = array.tobytes()
|
73 |
+
# Create a hash object (using SHA256 for example)
|
74 |
+
hash_obj = hashlib.sha256(array_bytes)
|
75 |
+
# Get the hexadecimal digest of the array
|
76 |
+
hash_hex = hash_obj.hexdigest()
|
77 |
+
return hash_hex
|
78 |
+
|
79 |
+
|
80 |
if os.path.isfile("rmvpe.pt"):
|
81 |
f0method_mode.insert(2, "rmvpe")
|
82 |
f0method_info = "PM is fast, Harvest is good but extremely slow, Rvmpe is alternative to harvest (might be better), and Crepe effect is good but requires GPU (Default: PM)"
|
|
|
351 |
protect,
|
352 |
f0_file=f0_file
|
353 |
)
|
354 |
+
hash_val = hash_array(audio_opt)
|
355 |
+
|
356 |
+
# Get the current thread's name or ID
|
357 |
+
thread_name = threading.current_thread().name
|
358 |
+
print(f"Thread {thread_name}: Hash {hash_val}")
|
359 |
+
|
360 |
+
# Print the hash and thread information
|
361 |
if resample_sr >= 16000 and tgt_sr != resample_sr:
|
362 |
tgt_sr = resample_sr
|
363 |
index_info = (
|