feat: voice to text
This commit is contained in:
parent
6fae26733d
commit
8011242194
6 changed files with 57 additions and 108 deletions
|
|
@ -3,19 +3,17 @@
|
|||
pkgs,
|
||||
config,
|
||||
hostConfig,
|
||||
whisper-dictation,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
whisper = pkgs.whisper-cpp.override { cudaSupport = hostConfig.gpu == "nvidia"; };
|
||||
modelDir = "${config.home.homeDirectory}/.local/share/whisper-models";
|
||||
model = "ggml-base.bin";
|
||||
model = "ggml-medium.bin";
|
||||
modelUrl = "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/${model}";
|
||||
in
|
||||
{
|
||||
home.packages = [
|
||||
whisper-dictation.packages.${hostConfig.platform}.default
|
||||
];
|
||||
home.packages = [ whisper ];
|
||||
|
||||
home.activation.downloadWhisperModel = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||
if [ ! -f "${modelDir}/${model}" ]; then
|
||||
|
|
@ -23,29 +21,4 @@ in
|
|||
run ${pkgs.curl}/bin/curl -L -o "${modelDir}/${model}" "${modelUrl}"
|
||||
fi
|
||||
'';
|
||||
|
||||
xdg.configFile."whisper-dictation/config.yaml".text = builtins.toJSON {
|
||||
whisper = {
|
||||
model = "base";
|
||||
language = "auto";
|
||||
};
|
||||
hotkey = {
|
||||
key = "KEY_DOT";
|
||||
modifiers = [ "KEY_LEFTMETA" ];
|
||||
};
|
||||
};
|
||||
|
||||
systemd.user.services.whisper-dictation = {
|
||||
Unit = {
|
||||
Description = "Whisper Dictation speech-to-text daemon";
|
||||
After = [ "graphical-session.target" "ydotoold.service" ];
|
||||
PartOf = [ "graphical-session.target" ];
|
||||
};
|
||||
Service = {
|
||||
ExecStart = "${whisper-dictation.packages.${hostConfig.platform}.default}/bin/whisper-dictation";
|
||||
Restart = "on-failure";
|
||||
RestartSec = 5;
|
||||
};
|
||||
Install.WantedBy = [ "graphical-session.target" ];
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue