Added support for adding as many files as you want. Also extended prompt numbers to 10 000 by default. Shuffle away!
Updated 21.3.:
Support for multiple input files added
Extended sample range to 10 000 by default
Tool that helps with selecting a random amount of prompts from a file that contains prompts. I am using it when testing the different prompt packages I am uploading. I'll take a big enough sample to generate a few images. Remove and fix obvious maligned prompts, rinse and repeat.
pip install gradio
gradio guitoolkit.py
or use python guitoolkit.py
Download this file / copy the code below into a file called guitoolkit.py (or whatever you want to call it)
Make/use a virtual environment python -m venv venv
Activate environment venv\Scripts\activate
Run the command pip install gradio to install the gradio library which is required to use this
When you have installed that, run either gradio guitoolkit.py or python guitoolkit.py
You should now have the tool ready to use if you get the following: gradio .\guitoolkit.py launching in reload mode on: http://127.0.0.1:7861 (Press CTRL+C to quit)
You can now visit http://127.0.0.1:7861 where the tool is ready to use
Input the file(s) you want to shuffle, select how many you want, copy the output, insert it into e.g. Automatic1111
import gradio as gr
import random
def shuffle_file(file_obj, no_prompts):
prompts = []
for file in file_obj:
with open(file.name) as infile:
in_prompts = infile.readlines()
prompts.extend(list(set(in_prompts)))
prompts = random.sample(prompts, no_prompts)
random.shuffle(prompts)
print(type(prompts))
return "".join(prompts)
demo = gr.Interface(
fn=shuffle_file,
inputs=["files", gr.Slider(5, 10000)],
outputs=["code"],
)
if __name__ == "__main__":
demo.launch(server_port=9800)
Added support for adding as many files as you want. Also extended prompt numbers to 10 000 by default. Shuffle away!
1. The rights to reposted models belong to original creators.
2. Original creators should contact SeaArt.AI staff through official channels to claim their models. We are committed to protecting every creator's rights. Click to Claim
