Spaces:
Sleeping
Sleeping
Upload myinfer_latest.py
Browse files16 unmodified lines171819202122232442 unmodified lines67686970717273747576777879808182268 unmodified lines35135235335435535635735835936036136236316 unmodified linesfrom flask import Flask, request, jsonify, send_file,session,render_templateimport base64import tempfileimport threadingimport hashlibimport osimport werkzeugfrom pydub import AudioSegment42 unmodified linesf0method_mode = ["pm", "harvest", "crepe"]f0method_info = "PM is fast, Harvest is good but extremely slow, and Crepe effect is good but requires GPU (Default: PM)"
def hash_array(array): # Ensure the array is in a consistent byte format array_bytes = array.tobytes() # Create a hash object (using SHA256 for example) hash_obj = hashlib.sha256(array_bytes) # Get the hexadecimal digest of the array hash_hex = hash_obj.hexdigest() return hash_hex
if os.path.isfile("rmvpe.pt"): f0method_mode.insert(2, "rmvpe") 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)"268 unmodified lines protect, f0_file=f0_file ) hash_val = hash_array(audio_opt) # Get the current thread's name or ID thread_name = threading.current_thread().name print(f"Thread {thread_name}: Hash {hash_val}") # Print the hash and thread information if resample_sr >= 16000 and tgt_sr != resample_sr: tgt_sr = resample_sr index_info = (myinfer_latest.py+19