Downloads · 30 days
6
5% of all-time downloads
AfkaraLP/mister-president-wakeword
mister-president-wakeword is a machine learning model from AfkaraLP. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
Custom wake word model for the phrase "mister president", trained with OpenWakeWord and Pocket TTS.
Downloads · 30 days
6
5% of all-time downloads
All-time downloads
114
Public
Repo size
8.2 MB
Likes
0
Public
Click a slice to open those files.
.onnx4.6 MB · 67%
From the Hugging Face model README
Custom wake word model for the phrase "mister president", trained with OpenWakeWord and Pocket TTS.
| Property | Value |
|---|---|
| Wake word | mister president |
| Architecture | WakeWordNet |
| Input | 16 frames x 96 features (raw audio embeddings) |
| Output | Probability [0, 1] |
| Calibrated threshold | 0.75 |
| Dimensions | 16 frames x 96 features |
Evaluated on held-out project data and (where available) OpenWakeWord test data.
| Metric | Value |
|---|---|
| Threshold | 0.75 |
| Recall (val) | 0.957 |
| FP Rate (val) | 0.058 |
mister_president.onnx
mister_president.onnx.data
mister_president_results.json
mister_president_benchmark.json
README.md
pip install openwakeword
import numpy as np
from huggingface_hub import hf_hub_download
from openwakeword import Model
# Download model from this repo
model_path = hf_hub_download(
repo_id="<your-username>/mister-president",
filename="mister_president.onnx",
)
# Load into openwakeword (supports multiple models)
oww = Model(wakeword_model_paths=[model_path])
model_name = list(oww.models.keys())[0]
# Stream audio in 1280-sample (80ms) chunks
sr, audio = scipy.io.wavfile.read("your_audio.wav")
if sr != 16000:
import scipy.signal
audio = scipy.signal.resample(
audio, int(len(audio) * 16000 / sr)
).astype(np.int16)
audio = audio.astype(np.int16)
threshold = 0.75
for i in range(0, len(audio), 1280):
chunk = audio[i : i + 1280]
if len(chunk) < 1280:
chunk = np.pad(chunk, (0, 1280 - len(chunk)))
prediction = oww.predict(chunk)
score = prediction.get(model_name, 0.0)
if score >= threshold:
print(f"Wake word detected! score={score:.3f}")
import numpy as np
import scipy.io.wavfile
import onnxruntime as ort
from huggingface_hub import hf_hub_download
from openwakeword.utils import AudioFeatures
# Download and load the ONNX model
model_path = hf_hub_download(
repo_id="<your-username>/mister-president",
filename="mister_president.onnx",
)
sess = ort.InferenceSession(model_path, providers=["CPUExecutionProvider"])
# Load audio (16kHz mono)
sr, audio = scipy.io.wavfile.read("your_audio.wav")
if len(audio.shape) > 1:
audio = audio[:, 0]
if sr != 16000:
from scipy.signal import resample
audio = resample(audio, int(len(audio) * 16000 / sr)).astype(np.int16)
audio = audio[:32000] # Pad or truncate to 2 seconds
# Compute embeddings and run inference
fe = AudioFeatures()
feats = fe.embed_clips(audio[None, :], batch_size=1).astype(np.float32)
score = sess.run(None, {sess.get_inputs()[0].name: feats})[0][0][0]
print(f'Wake word score: {score:.3f}')
print(f'Detected: {score >= 0.75}')