about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/graphics/neural-style/neural-style.sh
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/graphics/neural-style/neural-style.sh')
-rw-r--r--nixpkgs/pkgs/tools/graphics/neural-style/neural-style.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/tools/graphics/neural-style/neural-style.sh b/nixpkgs/pkgs/tools/graphics/neural-style/neural-style.sh
new file mode 100644
index 000000000000..07a4d6dedc04
--- /dev/null
+++ b/nixpkgs/pkgs/tools/graphics/neural-style/neural-style.sh
@@ -0,0 +1,25 @@
+#! @bash@/bin/bash
+
+declare -a args
+c=1
+flag=
+
+for arg in "$@"; do
+        if test "$arg" = "${arg#-}" && test "$arg" = "${arg#/}" && test -n "$flag"; then
+                arg="$PWD/$arg"
+                flag=
+        elif test "$arg" != "${arg%_image}" && test "$arg" != "${arg#-}"; then
+                flag=1
+        else
+                flag=
+        fi
+        args[c]="$arg";
+        c=$((c+1));
+done
+
+cd "@out@/lib/lua/neural-style"
+
+export LUA_PATH="$LUA_PATH${LUA_PATH:+;}@loadcaffe@/lua/?/init.lua;@loadcaffe@/lua/?.lua"
+export LUA_CPATH="$LUA_CPATH${LUA_CPATH:+;}@loadcaffe@/lib/?.so"
+
+@torch@/bin/th neural_style.lua "${args[@]}"