A discord bot that allows to use Stable Diffusion with Midjourney-like feel. Uses an API from AUTOMATIC1111's WebUI for interfering with Stable Diffusion
I live in Discord server
if you want to help this project, go to its todo list and implement something from there, it would help a lot
It provides few commands for now:
-
/diffuse
— txt2img inference -
/settings
— change settings on per-user bases -
/ping
— allows to ping a bot
And also provides buttons:
-
Cancle Job
— equivalent toInterrupt
button in the WebUI -
S<N>
— where<N>
is the image number; provides unchanged generated image -
U<N>
— where<N>
is the image number; upscales image with the user settings -
Info
— shows all information about the job -
Regen
— regenerates the request with the same parameteres, except for the seed
-
Install AUTOMATIC1111's WebUI and launch it with
--api
flag -
Clone this repository in any* folder using this command:
git clone https://github.com/Spaceginner/stable-reaction
*In folders that don't require administrative privileges to create and edit files in them
- Create venv using following:
python -m venv venv
- Now, you have to activate venv, run this in Stable Reaction folder if you have Windows:
cd venv\Scripts\
.\activate
cd ..\..\
or this if you have anything else than Windows:
cd venv\bin\
.\activate
cd ..\..\
- Then install all dependencies by running this command:
pip install -r requirements.txt
-
Go to Discord Developer Portal and create a new application
-
Go to
Bot
tab and create a bot, then pressReset Token
and copy a token DO NOT SHARE TOKEN WITH ANYBODY. Then openconfig.yaml
with any text editor and put your token intoken
field. -
To invite a bot to your server, go to
OAuth2
tab in Discord Developer Portal and then go toURL Generator
, then select following scopes:bot
,applications.commands
and these permissions:Send Messages
,Send Messages in Threads
,Attach Files
,Use Slash Commands
. At the bottom you will have an invite link.
8.1. (Optional) You can change the bot icon in Application
tab, just click upload an icon,
the icon itself you can find in resources\icon\
folder, you are interested in final.png
-
If you changed default URL in AUTOMATIC1111's WebUI,
-
then open
config.yaml
and changewebui_url
field respectively. -
Launch this bot (make sure venv is still active):
python app.py
- To test it, issue this command in discord:
/diffuse prompt:austronaut on a horse in space, Earth, concept art
Used libraries: PIL (Pillow), PyCord, requests and PyYAML
Tool used: Pattern Collider
Bot icon's pattern: link
To convert from SVG to PNG ImageMagick was used with the following command:
convert .\original.svg -resize 1024x1024^ -gravity center -crop 1024x1024+0+0 +repage .\final.png
This project is licensed under GPL-3.0 license