Skip to content

Commit

Permalink
Updated CLI args
Browse files Browse the repository at this point in the history
  • Loading branch information
dscripka committed Nov 7, 2023
1 parent da8c3c9 commit a2522e2
Showing 1 changed file with 26 additions and 9 deletions.
35 changes: 26 additions & 9 deletions examples/capture_activations.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,26 @@
default=False,
required=False
)
parser=argparse.ArgumentParser()
parser.add_argument(
"--chunk_size",
help="How much audio (in number of 16khz samples) to predict on at once",
type=int,
default=1280,
required=False
)
parser.add_argument(
"--model_path",
help="The path of a specific model to load",
type=str,
default="",
required=False
)
parser.add_argument(
"--model",
help="The model to use for openWakeWord, leave blank to use all available models",
"--inference_framework",
help="The inference framework to use (either 'onnx' or 'tflite'",
type=str,
default='tflite',
required=False
)
parser.add_argument(
Expand All @@ -87,25 +103,26 @@
FORMAT = pyaudio.paInt16
CHANNELS = 1
RATE = 16000
CHUNK = 1280
CHUNK = args.chunk_size
audio = pyaudio.PyAudio()
mic_stream = audio.open(format=FORMAT, channels=CHANNELS, rate=RATE, input=True, frames_per_buffer=CHUNK)

# Load pre-trained openwakeword models
if args.model:
if args.model_path:
model_paths = openwakeword.get_pretrained_model_paths()
for path in model_paths:
if args.model in path:
if args.model_path in path:
model_path = path

if model_path:
owwModel = Model(
wakeword_model_paths=[model_path],
wakeword_models=[model_path],
enable_speex_noise_suppression=args.noise_suppression,
vad_threshold = args.vad_threshold
)
vad_threshold = args.vad_threshold,
inference_framework=args.inference_framework
)
else:
print(f'Could not find model \"{args.model}\"')
print(f'Could not find model \"{args.model_path}\"')
exit()
else:
owwModel = Model(
Expand Down

0 comments on commit a2522e2

Please sign in to comment.