This is the code currently running over at @ai621bot on telegram. Yes it is horrible code and i am ashamed of it. The idea under publishing it is to finally give it some well needed cleanup.
Go to file
nameless 4c3a2f405b example config: add comments, change port 2023-08-15 21:36:46 +00:00
.gitignore (real) initial commit 2023-07-04 20:19:03 +02:00
LICENSE Initial commit 2023-07-04 18:09:16 +00:00
README.md Update README.md 2023-08-15 20:46:47 +00:00
ai621.example.db db counter reset, schema update 2023-08-15 20:11:29 +00:00
bot.py button for negative_prompt removal 2023-08-15 21:18:45 +00:00
config.example.py example config: add comments, change port 2023-08-15 21:36:46 +00:00
e621_import.py (real) initial commit 2023-07-04 20:19:03 +02:00
judge_prompt.py (real) initial commit 2023-07-04 20:19:03 +02:00
process_queue.py minimize compression damage with image resize 2023-08-15 18:45:31 +00:00
requirements.txt Added requirements.txt for python! 2023-07-05 07:10:24 +00:00
yiffy_tags.csv yiffy-e18 tags -> fluffyrock-3m tags 2023-08-15 19:14:11 +00:00

README.md

ai621 (A1111 webui fork)

This is fork of ai621 (https://git.foxo.me/AI621/ai621) bot that contains some additional features/fixes.

How does it work?

This is only the "bot" part. The actual generation is done by AUTOMATIC1111 Stable Diffusion web UI. To run this, you have to install and run an AUTOMATIC1111 Stable Diffusion web UI (https://github.com/AUTOMATIC1111/stable-diffusion-webui) instance and define the IP/hostname in the config files so that the bot can query and send data to port 7860 using the embedded api.

How do i run it?

  • Create bot account. To get a bot account, you need to talk with @BotFather.
  • Create two Telegram channels - one for output, and one for log. Add your bot as administrator, enable rights to post messages.
  • Start your A1111 web UI instance. Don't forget to add --api to set COMMANDLINE_ARGS= in webui-user.bat!
  • Obtain a Telegram api_id: https://docs.telethon.dev/en/stable/basic/signing-in.html
  • Create a Python virtual env to not pollute your system: https://docs.python.org/3/library/venv.html#creating-virtual-environments
  • Install all the dependencies needed by the bot using pip install -r requirements.txt after activating the venv
  • Copy example config file, rename it to config.py and edit it following the instructions.
  • Copy example database and rename it to ai621.db.
  • Run the bot with python3 bot.py

User data

Data is stored inside "ai621.db": three tables (user, prompt and pending_prompt) define all the data. Additionally, uploaded images (for the img2img mode) are stored inside the "userdata/" folder which is inside of the work folder.

Can you define multiple video cards / nodes to speed generation up?

No. Or at least, not anymore. You will notice from the example configuration that three nodes were defined. This was working properly, until i accidentally overwrote the files that were responsible for that with an older version that didn't have that function anymore. I didn't bother.

What are the log and raw channels?

ai621 posts all generated images to a channel called "ai621 raw", and then forwards them to the user at the end of the prompt processing. This is so that everybody can see and get inspired by other prompts. This is what the raw channel is. The log channel, instead, is where all prompts and stored along with buttons to be able to moderate users (delete prompts and ban users).

What are "cycles"?

Every day each user has a defined number of cycles, also known as "steps". Since steps can be defined in a sorta stable amount of time, this is used to make sure that all users can fairly use the bot.

Some specific prompts also ramp up the amount of cycles used as a "penalty", like using blacklisted tags or bad quality prompts.