]> git.cworth.org Git - zombocom-ai/blobdiff - generate-image.py
Reword Coda's final message
[zombocom-ai] / generate-image.py
index 3a2d3f3f65593fdd03a4b308af3ebd412295abf0..f5502c6321d337ccdd8435f84e01737aeb0a3fdf 100755 (executable)
@@ -27,10 +27,11 @@ def save_artifact(artifact, prompt):
     counter = 1
     seed = artifact.seed
     while True:
+        prompt_abbrev = prompt[:200]
         if counter > 1:
-            base = "{}_{}_{}.png".format(seed, prompt, counter)
+            base = "{}_{}_{}.png".format(seed, prompt_abbrev, counter)
         else:
-            base = "{}_{}.png".format(seed, prompt)
+            base = "{}_{}.png".format(seed, prompt_abbrev)
         base = normalize_filename(base)
         filename = "{}{}/{}".format(DOCUMENT_ROOT, IMAGES_PATH, base)
         if not os.path.exists(filename):
@@ -63,15 +64,17 @@ def main() -> None:
     stability_api = client.StabilityInference(
         key=os.environ['STABILITY_KEY'],
         verbose=True,
-        engine="stable-diffusion-512-v2-0"
+        engine="stable-diffusion-768-v2-1"
     )
 
     prompt_string = " ".join(args.prompt)
 
     if args.seed:
-        answers = stability_api.generate(seed=args.seed, prompt=prompt_string)
+        answers = stability_api.generate(width=768, height=768,
+                                         seed=args.seed, prompt=prompt_string)
     else:
-        answers = stability_api.generate(prompt=prompt_string)
+        answers = stability_api.generate(width=768, height=768,
+                                         prompt=prompt_string)
 
     results = []
     for resp in answers: