wav file resampling

This commit is contained in:
Concedo 2024-05-30 13:41:58 +08:00
parent 62ab344b1e
commit 961c789c91
2 changed files with 46 additions and 10 deletions

View file

@ -649,6 +649,8 @@ def whisper_generate(genparams):
is_quiet = True if args.quiet else False
prompt = genparams.get("prompt", "")
audio_data = genparams.get("audio_data", "")
if audio_data.startswith("data:audio"):
audio_data = audio_data.split(",", 1)[1]
inputs = whisper_generation_inputs()
inputs.prompt = prompt.encode("UTF-8")
inputs.audio_data = audio_data.encode("UTF-8")
@ -660,7 +662,7 @@ def whisper_generate(genparams):
return outstr
def utfprint(str):
maxlen = 30000
maxlen = 25000
strlength = len(str)
if strlength > maxlen: #limit max output len
str = str[:maxlen] + f"... (+{strlength-maxlen} chars)"