summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs/simple/stable-generate/default.nix
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2022-11-22 19:38:36 +0100
committertv <tv@krebsco.de>2022-11-22 19:38:36 +0100
commit1c4e27473c46faf4b4a4c800cb29cdabf73f716f (patch)
treed9ec3e9b4a2e77f9e8baf2e8601a5cc9439131eb /krebs/5pkgs/simple/stable-generate/default.nix
parent12ce60ff1435a71ee4cf0431223c129010e7df73 (diff)
parentfef385511d07c1ea5be1eae4fd8dd7eba563ab2c (diff)
Merge remote-tracking branch 'prism/master'
Diffstat (limited to 'krebs/5pkgs/simple/stable-generate/default.nix')
-rw-r--r--krebs/5pkgs/simple/stable-generate/default.nix64
1 files changed, 64 insertions, 0 deletions
diff --git a/krebs/5pkgs/simple/stable-generate/default.nix b/krebs/5pkgs/simple/stable-generate/default.nix
new file mode 100644
index 000000000..fac261613
--- /dev/null
+++ b/krebs/5pkgs/simple/stable-generate/default.nix
@@ -0,0 +1,64 @@
+{ pkgs, lib, ... }:
+
+pkgs.writers.writeDashBin "stable-generate" ''
+ set -efu
+
+ export PATH=${lib.makeBinPath [
+ pkgs.curl
+ pkgs.jq
+ ]}
+
+ STABLE_URL=''${STABLE_URL:-http://stable-confusion.r}
+
+ PAYLOAD=$(jq -cn --arg query "$*" '{fn_index: 51, data: [
+ $query,
+ "",
+ "None",
+ "None",
+ 20, # sampling steps
+ "Euler a", # sampling method
+ false, # restore faces
+ false,
+ 1,
+ 1,
+ 7,
+ -1,
+ -1,
+ 0,
+ 0,
+ 0,
+ false,
+ 512, #probably resolution
+ 512, #probably resolution
+ false,
+ 0.7,
+ 0,
+ 0,
+ "None",
+ "",
+ false,
+ false,
+ false,
+ "",
+ "Seed",
+ "",
+ "Nothing",
+ "",
+ true,
+ false,
+ false,
+ null,
+ "",
+ ""], session_hash: "hello_this_is_dog"}')
+
+ data=$(curl -Ssf "$STABLE_URL/run/predict/" \
+ -X POST \
+ --Header 'Content-Type: application/json' \
+ --data "$PAYLOAD"
+ )
+ export data
+
+ filename=$(jq -rn 'env.data | fromjson.data[0][0].name')
+
+ echo "$STABLE_URL/file=$filename"
+''