bulkai

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2023 License: MIT Imports: 21 Imported by: 0

README

bulkai

bulkai is a tool to generate AI images in bulk

Features

bulkai works with the following AI image generators:

  • Midjourney
  • Bluewillow

bulkai automates the following tasks:

  • Send prompts to the AI
  • Upscale the generated images
  • Or crop the preview images if upscale is disabled
  • Optionally, generate variations of the generated images
  • Download the generated images
  • Create thumbnails
  • Generate a HTML album page with the generated images

Installation

You can use the golang binary to install bulkai:

To install the cli:

go install github.com/igolaizola/bulkai/cmd/bulkai@latest

To install the GUI:

go install github.com/igolaizola/bulkai/cmd/bulkai-gui@latest

Or you can download the binary from the releases

Usage: command-line interface

The binary you need to use is bulkai.

1. Create session (only for the first time)

You first need to create a session file with the discord credentials and other information retrieved from your browser. bulkai needs this to:

  • Be able to login to Discord
  • Mimic the browser and avoid being detected as a bot

Use the bulkai create-session command to create the session file. It will open a chrome window and you will need to login to Discord.

bulkai create-session
2. Configure settings

You can configure different settings. See the parameters section to see all available options: Parameters

Using a configuration file in YAML format:

bulkai generate --config bulkai.yaml

bulkai.yaml

bot: midjourney
album: cute-animals
download: true
upscale: true
variation: false
thumbnails: true
suffix: " --ar 3:2"
prompt:
  - cute-animals-1.txt
  - cute-animals-2.txt
  - cute monkey dancing on a tree
2. Launch

Use the bulkai generate command to launch the generation. Images will be downloaded to the album name in the output directory specified in the configuration file. You will be able to see the progress in the console. This task can take a long time depending on the number of images to generate.

bulkai generate

You can press Ctrl+C to stop the generation. If you want to resume the generation, just press launch the command again using the same settings and album name. Prompt field will be ignored and the prompts will be loaded from the album.

Usage: graphical user interface

The binary you need to use is bulkaigui.

1. Create session (only for the first time)

You first need to create a session file with the discord credentials and other information retrieved from your browser. bulkai needs this to:

  • Be able to login to Discord
  • Mimic the browser and avoid being detected as a bot

Go to the Settings tab and click on the Create session button.

2. Configure settings

On the Settings tab you can configure different settings. This options will be saved in the configuration file. See the parameters section to see all available options: Parameters

On the Main tab you can set the name of the album and the prompts to use. Each line will be processed as a different prompt. You can also set the path to a prompt file instead.

3. Launch

Press the Start button to launch the generation. Images will be downloaded to the album name in the output directory specified in the configuration file. You will be able to see the progress in the window. This task can take a long time depending on the number of images to generate.

You can use the Stop button to stop the generation. If you want to resume the generation, just press the Start button again using the same settings and album name. Prompt field will be ignored and the prompts will be loaded from the album.

Parameters

Here is a list of all the parameters available to run the image generation.

  • bot (string): Name of the bot to use. Available options are: midjourney and bluewillow. (required)
  • download (bool): Download the generated images. (default: true)
  • upscale (bool): Upscale the generated images. (default: true) If you disable this the generation will be much faster. It will directly use the preview images generated by the AI. In midjourney for example, the preview images are 256x256.
  • variation (bool): Generate variations of the generated images. (default: false) This will generate 4 extra variations of each prompt. The generation will be much slower.
  • thumbnail (bool): Generate thumbnails of the generated images. (default: true) This operation is done locally, it will improve the performance of the HTML page.
  • suffix (string): Suffix to add to all prompts. (optional)
  • prefix (string): Prefix to add to all prompts. (optional)
  • prompt (list): List of prompts to use. (required) If you want include prompts from a file, just write the path to the file.
  • album (string): Name of the album. (optional, but recommended) If unset a time based name will be used.
  • output (string): Path to the output directory. (default: ./output)
  • session (string): Path to the session file. (default: ./session.json)
  • channel (string): Name of the channel to use in the form guild/channel. (optional) If unset the DM chat with the bot will be used.
  • proxy (string): Proxy to use in HTTP calls. (optional)
  • concurrency (int): How many prompts can be running at the same time. (optional) If unset the maximum for the bot will be used.
  • wait (int): Time to wait between prompts. (optional) There is already a rate limit implemented to avoid sending too many requests to discord.
  • debug (bool): Enable debug mode. (default: false)

Disclaimer

The automation of User Discord accounts also known as self-bots is a violation of Discord Terms of Service & Community guidelines and will result in your account(s) being terminated.

The automation of Midjourney and Bluewillow accounts is also a violation of their Terms of Service and will result in your account(s) being terminated.

Read about Discord, Midjourney and Bluewillow Terms of Service and Community Guidelines

bulkai was written as a proof of concept and the code has been released for educational purposes only. The authors are released of any liabilities which your usage may entail.

Support

If you've found my code useful, please support my late nights spent coding and the coffees I drink to keep me going!

You can support me by buying me a coffee:

Donating to my PayPal:

paypal.me/igolaizola

Sponsoring me on GitHub:

github.com/sponsors/igolaizola

Or by donating to any of my crypto addresses:

  • BTC bc1qvuyrqwhml65adlu0j6l59mpfeez8ahdmm6t3ge
  • ETH 0x960a7a9cdba245c106F729170693C0BaE8b2fdeD
  • USDT (TRC20) TD35PTZhsvWmR5gB12cVLtJwZtTv1nroDU
  • USDC (BEP20) / BUSD (BEP20) 0x960a7a9cdba245c106F729170693C0BaE8b2fdeD
  • Monero 41yc4R9d9iZMePe47VbfameDWASYrVcjoZJhJHFaK7DM3F2F41HmcygCrnLptS4hkiJARCwQcWbkW9k1z1xQtGSCAu3A7V4

Thanks for your support!

Resources

Some of the resources I used to create this project:

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(ctx context.Context, cfg *Config, opts ...Option) error

Generate launches multiple ai generations.

func SaveAlbum

func SaveAlbum(dir string, a *Album, thumbnail bool) error

Types

type Album

type Album struct {
	ID         string    `json:"id"`
	CreatedAt  time.Time `json:"created_at"`
	UpdatedAt  time.Time `json:"updated_at"`
	Status     string    `json:"status"`
	Percentage float32   `json:"percentage"`
	Images     []*Image  `json:"images"`
	Prompts    []string  `json:"prompts"`
	Finished   []int     `json:"finished"`
}

type Config

type Config struct {
	Debug       bool          `yaml:"debug"`
	Bot         string        `yaml:"bot"`
	Proxy       string        `yaml:"proxy"`
	Output      string        `yaml:"output"`
	Album       string        `yaml:"album"`
	Prefix      string        `yaml:"prefix"`
	Suffix      string        `yaml:"suffix"`
	Prompts     []string      `yaml:"prompts"`
	Variation   bool          `yaml:"variation"`
	Upscale     bool          `yaml:"upscale"`
	Download    bool          `yaml:"download"`
	Thumbnail   bool          `yaml:"thumbnail"`
	Channel     string        `yaml:"channel"`
	Concurrency int           `yaml:"concurrency"`
	Wait        time.Duration `yaml:"wait"`
	SessionFile string        `yaml:"session"`
	Session     Session       `yaml:"-"`
}

type Image

type Image struct {
	URL    string `json:"url"`
	Prompt string `json:"prompt"`
	File   string `json:"file"`
}

type Option

type Option func(*option)

func WithOnUpdate

func WithOnUpdate(onUpdate func(Status)) Option

type Session

type Session struct {
	JA3             string `yaml:"ja3"`
	UserAgent       string `yaml:"user-agent"`
	Language        string `yaml:"language"`
	Token           string `yaml:"token"`
	SuperProperties string `yaml:"super-properties"`
	Locale          string `yaml:"locale"`
	Cookie          string `yaml:"cookie"`
}

type Status

type Status struct {
	Percentage float32
	Estimated  time.Duration
}

Directories

Path Synopsis
cmd
pkg
ai
gui
img

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL