objectifier/yolo-cli.nix

29 lines
742 B
Nix
Raw Normal View History

2023-01-10 23:05:42 -08:00
{ pkgs, yolov3-data, ... }:
2023-01-06 14:46:11 -08:00
let
name = "yolo-cli";
pythonYolo = pkgs.python3.withPackages (pyPkgs: with pyPkgs; [ opencv4 ]);
yoloCliFiles = pkgs.stdenv.mkDerivation {
name = "yolo-cli-src";
src = ./src;
phases = [ "installPhase" ];
installPhase = ''
mkdir -p $out
cp $src/detector.py $out/detector.py
cp $src/yolo-cli.py $out/yolo-cli.py
chmod +x $out/yolo-cli.py
'';
};
in pkgs.writeShellApplication {
inherit name;
runtimeInputs = [ pythonYolo ];
text = pkgs.lib.concatStringsSep " " [
"${yoloCliFiles}/yolo-cli.py"
2023-01-10 23:05:42 -08:00
"--yolo_weights=${yolov3-data}/yolov3.weights"
"--yolo_config=${yolov3-data}/yolov3.cfg"
"--yolo_labels=${yolov3-data}/labels"
2023-01-06 14:46:11 -08:00
''"$@"''
];
}