objectifier/yolo-cli.nix

29 lines
734 B
Nix

{ pkgs, yolo-data, ... }:
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"
"--yolo_weights=${yolo-data}/yolov3.weights"
"--yolo_config=${yolo-data}/yolov3.cfg"
"--yolo_labels=${yolo-data}/labels"
''"$@"''
];
}