From f4d308a827d5a10bd4b9be87cbf2057203936af1 Mon Sep 17 00:00:00 2001 From: exectails Date: Sun, 24 Nov 2024 13:09:34 +0100 Subject: [PATCH] Updated readme --- README.md | 68 ++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 55 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index b712675..f37a4c7 100644 --- a/README.md +++ b/README.md @@ -14,26 +14,68 @@ Several nodes with varying numbers of optional inputs that can be used in conjunction with a formatting string to create the output. The node uses standard [python string formatting][1]. -**Example** -```text -Input: -- arg0: "John" -- arg1: 42 - -Format: -"Hello, {arg0}! Did you know? {arg1} is the answer to everything." - -Output: -"Hello, John! Did you know? 42 is the answer to everything." -``` - The nodes are useful to compose prompts based on variable inputs and can be combined with [dynamic prompts][2] for even more flexibility. +**Example** + +Insert values into a string. + +Format +```text +"Hello, {arg0}! Did you know? {arg1} is the answer to everything." +``` + +Input +```text +arg0: "John" +arg1: 42 +``` + +Output +```text +"Hello, John! Did you know? 42 is the answer to everything." +``` + ### ATOI/ITOA Two simple nodes to convert strings to integers and vice versa. +### Python Text Script + +A node that takes a number of inputs as well as a Python script that +takes the given arguments to produce a result. Intended as a brute- +force method in cases where a general purpose formatter might not +cut it and no dedicated node is available. The value assigned to +the `result` variable inside the script will be returned by the +node. + +**Example** + +Return a description based on a numeric input. + +Script +```python +age = int(arg0) + +if age < 13: + result = "a nice child" +elif age < 22: + result = "an angsty teenager" +else: + result = "a mature adult" +``` + +Input +```text +arg0: 17 +``` + +Onput +```text +"an angsty teenager" +``` + [1]: https://docs.python.org/3/tutorial/inputoutput.html [2]: https://github.com/exectails/comfyui-et_dynamicprompts