gracefully handle missing portaudio

This commit is contained in:
Paul Gauthier 2023-08-10 16:55:45 -03:00
parent fed24aa444
commit 7b993a9bbb
2 changed files with 16 additions and 4 deletions

View file

@ -3,12 +3,21 @@ import queue
import tempfile
import openai
import sounddevice as sd
try:
import sounddevice as sd
except OSError:
sd = None
import soundfile as sf
from .dump import dump # noqa: F401
def is_audio_available():
return sd is not None
def record_and_transcribe():
q = queue.Queue()