Spaces:
Sleeping
Sleeping
Upload myinfer_latest.py
Browse files16 unmodified lines17181920212242 unmodified lines656667686970268 unmodified lines33934034134234334416 unmodified linesfrom flask import Flask, request, jsonify, send_file,session,render_templateimport base64import tempfileimport 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)"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 linesprotect,f0_file=f0_file)if resample_sr >= 16000 and tgt_sr != resample_sr:tgt_sr = resample_srindex_info = (16 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 formatarray_bytes = array.tobytes()# Create a hash object (using SHA256 for example)hash_obj = hashlib.sha256(array_bytes)# Get the hexadecimal digest of the arrayhash_hex = hash_obj.hexdigest()return hash_hexif 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 linesprotect,f0_file=f0_file)hash_val = hash_array(audio_opt)# Get the current thread's name or IDthread_name = threading.current_thread().nameprint(f"Thread {thread_name}: Hash {hash_val}")# Print the hash and thread informationif resample_sr >= 16000 and tgt_sr != resample_sr:tgt_sr = resample_srindex_info = (
myinfer_latest.py+19