bulkai

package module
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: MIT Imports: 21 Imported by: 0

README

bulkai 🤖🎨

bulkai is a tool to generate AI images in bulk

📢 Connect with us! Join our Telegram group for support and collaboration: t.me/igohub

🚀 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:

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

Or you can download the binary from the releases

🕹️ Usage

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
thumbnail: 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.

🛠️ 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.
  • html (bool): Generate HTML files to show and link the generated images. (default: true)
  • 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): ID of the channel to use in the form guild-id/channel-id. (optional) You can obtain it from the URL of the channel in discord web. 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 (duration): Time to wait between prompts, for example 5s. (optional) There is already a rate limit implemented to avoid sending too many requests to discord.
  • midjourney-cdn (bool): Use Midjourney CDN for URLs instead of Discord CDN URLs. (default: false)
  • debug (bool): Enable debug mode. (default: false)

❓ FAQ

Do I need to generate a new session every time I want to use use bulkai?

No, you only need to generate a new session if you want to use a different account.

Do I need to enable relaxed mode?

It is up to you to use relaxed or fast mode. Just keep in mind that if you use fast mode with a lot of prompts, you may consume your quota very quickly.

I'm getting couldn't find dm channel for bot error

You must manually join the discord server of the bot you want to use. Then you have to open a DM chat with the bot. Alternatively, you can specify the channel to use in the form guild/channel. The bot must be available in the channel you specify.

⚠️ 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 have found my code helpful, please give the repository a star ⭐

Additionally, if you would like to support my late-night coding efforts and the coffee that keeps me going, I would greatly appreciate a donation.

You can invite me for a coffee at ko-fi (0% fees):

ko-fi

Or at buymeacoffee:

buymeacoffee

Donate to my PayPal:

paypal.me/igolaizola

Sponsor me on GitHub:

github.com/sponsors/igolaizola

Or donate 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, html 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"`
	Html           bool          `yaml:"html"`
	Channel        string        `yaml:"channel"`
	Concurrency    int           `yaml:"concurrency"`
	Wait           time.Duration `yaml:"wait"`
	ReplicateToken string        `yaml:"replicate-token"`
	MidjourneyCDN  bool          `yaml:"midjourney-cdn"`
	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
img

Jump to

Keyboard shortcuts

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