Coder Social home page Coder Social logo

darkprompts's Introduction

DarkPrompts

A slightly better tool for generating random prompts.

DarkPrompt

DarkPrompt reads lines from a file and/or a text input, combines them together, optionally strips out comments and blank lines, and then selects a random line for use in generating your prompt based on a seed input. It also has a prefix and suffix field so you can easily include additional information with each prompt or wrap it inside a weight. For example a prefix of ( and a suffix of :1.2) could return a string: (walking a dog:1.2) from an file named activities.txt that contains a line walking a dog. There are additional options for randomly disabling a DarkPrompt object from returning anything. This is useful when you might have a section of prompting that you only occasionally want to include. For example, you might have different types of shoes you want to add to your character, but occasionally you want the prompt to not mention shoes at all.

Unlike several other ComfyUI projects, the box is somewhat more compact, gives you an easy way to combine file and text sources for prompt generation, and most importantly it re-reads the files after every prompt generation so you don't have to restart ComfyUI after editing wildcard files.

DarkCombiner

DarkCombiner accepts up to 7 text inputs and combines them with an optional delimiter (\n by default) with a string output. This allows you to easily combine multiple DarkPrompt nodes to generate complex prompts. It isn't really needed anymore since DarkPrompt supports combining from previous DarkPrompt nodes.

DarkLoraTagLoader

DarkLoraTagLoader is a modified version of [LoraTagLoader(https://github.com/badjeff/comfyui_lora_tag_loader)] that also outputs a LORA_STACK of detected LoRAs for use in things like the Efficient Loader for doing XY Plots. LoraTagLoader is licensed under the freedom-hating GPL v3 license which is why the code for DarkLoraTagLoader is under the gplv3 folder and is licensed separately from other files in this project.

DarkFaceIndexShuffle

ComfyUI-Reactor-Node supports swapping faces by providing a CSV index of faces (i.e. "0,1,2,3,4,5"). DarkFaceIndexShuffle allows you to enter an array of faces, shuffle the array based on a seed, and stick the result into the Reactor input_faces_index input. This allows you to randomize faces and the order of friends in the scene generated by your prompts.

DarkCheckpointRandomizer

Allows you to provide a text-based list of checkpoints (one per line) to be randomly chosen on each generation. You can optionally specify how many iterations to use the checkpoint for. For example you can specify:

sdXL_v10.safetensors
albedobaseXL_v21.safetensors

...in your list and use_for_iterations to 5. DarkCheckpointRandomizer would pick one of them at random and continue using it for 5 generations. Then it would pick another one at random. DarkCheckpointRandomizer will automatically weed out blank lines and checkpoints that don't exist. Checkpoints that don't exist are logged to the console.

DarkFolder

DarkFolder is used to dynamically generate folder paths for saving images. Having a huge output directory with tons of files makes sorting images a huge pain. Sure, some people use a date-prefix to create folders, but in any given day you could have thousands or tens of thousands of images. That's still painful to sort through. DarkFolder works with nodes like 'Save Image w/ Metadata' (From comfy-image-saver) that have a path option for saving images.

DarkFolder takes a prefix (batch- by default) and a folder_size and dynamically generates a new path based on the number of images in existing folders. Additionally there is a selection_method for choosing how to handle existing folders.

Let's say every time you run a batch on ComfyUI you end up with 8 new images, and you have DarkFolder set to a size of 16 with the selection method set to Highest Not Full. On the first run, it would create a folder called batch-0 and toss the 8 newly generated images into it. On the second run, since batch-0 only has 8 images and the highest "not-full" folder is batch-0 it will drop the next 8 images in there. On the third run, batch-0 has 16 images. Since folder_size is set to 16, DarkFolder will tell your image saver to use a new folder called batch-1 until it has 16 or more images in it.

The selection methods:

Fill Gaps: This will search through any existing folders starting with 0. Once it finds a folder with less than $folder_size images in it, it saves there.

Highest Not Full: Regardless of how many folders you have (some could be empty because you've been sorting/deleting), it will find the highest numbered folder that actually contains images

New Every Generation: This basically ignores $folder_size and just creates a new folder every generation

Screenshot

DarkPrompt

Installation Using ComfyUI Manager

DarkPrompts should now show up in the list of modules in ComfyUI Manager. If not, you can copy the URL of this repo and paste it into the "Install via Git URL" box and restart ComfyUI.

Installation into ComfyUI

Go into your custom_nodes directory and run a git clone https://github.com/darkpixel/darkprompts.git and then restart ComfyUI.

darkprompts's People

Contributors

darkpixel avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

darkprompts's Issues

Files should be read on queuing, not running

Files are currently re-read when the job actually starts, not when it is queued.

This makes it impossible (for example) to make changes to a file and queue it up. If there's already a job in the queue and you make changes to a file and queue another job, the job will read the current state of the file NOT the queued state of the file.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.