Compare commits
2 Commits
v0.0.2
...
0aff4f556b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0aff4f556b | ||
|
|
88bf54d022 |
@@ -136,7 +136,7 @@ class Parser(threading.Thread):
|
|||||||
p = "/tmp/whisper-cpp.wav"
|
p = "/tmp/whisper-cpp.wav"
|
||||||
with open("/tmp/whisper-cpp.wav", "wb") as f:
|
with open("/tmp/whisper-cpp.wav", "wb") as f:
|
||||||
f.write(wav)
|
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()
|
result = proc.stdout.decode().strip()
|
||||||
if os.environ.get("DEBUG", None):
|
if os.environ.get("DEBUG", None):
|
||||||
log("stderr:", proc.stderr.decode().strip())
|
log("stderr:", proc.stderr.decode().strip())
|
||||||
@@ -144,6 +144,7 @@ class Parser(threading.Thread):
|
|||||||
result = result.replace(">>", "")
|
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]])
|
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):
|
if os.environ.get("DEBUG", None):
|
||||||
log("annotation-free transcript:", result)
|
log("annotation-free transcript:", result)
|
||||||
return result
|
return result
|
||||||
@@ -319,9 +320,12 @@ class Actor(threading.Thread):
|
|||||||
body = self.body
|
body = self.body
|
||||||
body = body.replace("{{hotword}}", hotword)
|
body = body.replace("{{hotword}}", hotword)
|
||||||
body = body.replace("{{context}}", context)
|
body = body.replace("{{context}}", context)
|
||||||
|
url = self.url
|
||||||
|
url = url.replace("{{hotword}}", hotword)
|
||||||
|
url = url.replace("{{context}}", context)
|
||||||
if os.environ.get("DEBUG", "") :
|
if os.environ.get("DEBUG", "") :
|
||||||
log("POST", self.url, headers, body)
|
log("POST", url, headers, body)
|
||||||
requests.post(self.url, headers=headers, data=body)
|
requests.post(url, headers=headers, data=body)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log("Actor.handle_url:", e)
|
log("Actor.handle_url:", e)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user