cleaned up client refs

This commit is contained in:
Paul Gauthier 2024-04-17 15:47:07 -07:00
parent f1a31d3944
commit c770fc4380
7 changed files with 16 additions and 30 deletions

View file

@ -26,7 +26,7 @@ class Voice:
threshold = 0.15
def __init__(self, client):
def __init__(self):
if sf is None:
raise SoundDeviceError
try:
@ -37,8 +37,6 @@ class Voice:
except (OSError, ModuleNotFoundError):
raise SoundDeviceError
self.client = client
def callback(self, indata, frames, time, status):
"""This is called (from a separate thread) for each audio block."""
rms = np.sqrt(np.mean(indata**2))
@ -88,6 +86,7 @@ class Voice:
while not self.q.empty():
file.write(self.q.get())
# TODO: fix client!
with open(filename, "rb") as fh:
transcript = self.client.audio.transcriptions.create(
model="whisper-1", file=fh, prompt=history, language=language