feat : dont import pyaudio if stt not enabled

This commit is contained in:
martin legrand 2025-03-22 12:44:41 +01:00
parent 771ac22d7f
commit 76f52846de

View File

@ -3,10 +3,8 @@ import queue
import threading
import numpy as np
import torch
from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline
import time
import librosa
import pyaudio
from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline
audio_queue = queue.Queue()
done = False
@ -16,6 +14,7 @@ class AudioRecorder:
AudioRecorder is a class that records audio from the microphone and adds it to the audio queue.
"""
def __init__(self, format: int = pyaudio.paInt16, channels: int = 1, rate: int = 4096, chunk: int = 8192, record_seconds: int = 5, verbose: bool = False):
import librosa
import pyaudio
self.format = format
self.channels = channels