master
bel 2023-04-08 20:05:03 -06:00
parent 88bf54d022
commit 0aff4f556b
1 changed files with 2 additions and 1 deletions

View File

@ -136,7 +136,7 @@ class Parser(threading.Thread):
p = "/tmp/whisper-cpp.wav"
with open("/tmp/whisper-cpp.wav", "wb") as f:
f.write(wav)
proc = subprocess.run(f"MODEL=./models/ggml-{os.environ.get('MODEL','tiny.en')}.bin WAV={p} P=2 rust-whisper", capture_output=True, shell=True)
proc = subprocess.run(f"MODEL=./models/ggml-{os.environ.get('MODEL','tiny.en')}.bin WAV={p} P={os.environ.get('P', '2')} rust-whisper", capture_output=True, shell=True)
result = proc.stdout.decode().strip()
if os.environ.get("DEBUG", None):
log("stderr:", proc.stderr.decode().strip())
@ -144,6 +144,7 @@ class Parser(threading.Thread):
result = result.replace(">>", "")
result = "".join([i.split("]")[-1] for i in result.split("[")[0]])
result = "".join([i.split(")")[-1] for i in result.split("(")[0]])
result = "".join([i.split(">")[-1] for i in result.split("<")[0]])
if os.environ.get("DEBUG", None):
log("annotation-free transcript:", result)
return result