| import sounddevice as sd # records and plays audio (pure Python + tiny C) | |
| import soundfile as sf # saves audio to .wav files | |
| import whisper # OpenAI's speech-to-text (tiny model = CPU-friendly) | |
| from piper.voice import PiperVoice # super natural text-to-speech | |
| import tempfile # creates temporary files that auto-delete | |
| import os | |
| print("Loading whisper model") | |
| whisper_model = whisper.load_model("/models/whisper/tiny.pt") | |
| print("Model ready") | |
| print("Loading...") | |
| piper_voice = PiperVoice.load( | |
| "/models/piper/ryan-high.onnx", | |
| config_path="/models/piper/ryan-high-onnx.json" | |
| ) | |
| print("Piper ready...") |