This bot allows for you to have access to stable diffusion at your fingertips!
- @ the bot with the text you would like to generate
- It will send a photo to you shortly after
- You can send negative prompts to filter out items you would like to exclude by using -= or -- at the end of your prompt like below
soup -= chicken, turkey, tomato would inform stable diffusion to avoid generating soups with chicken, turkey or tomato. This will still include any default negative prompts from the .env file.
soup -- chicken, turkey, tomato would inform stable diffusion to avoid generating soups with chicken, turkey or tomato. This will override any default negative prompts from the .env file.
- Clone this repository to a folder with at least 5 GB free
git clone https://github.com/maltob/slack-txtoimgbot.git
- Open the directory
cd slack-txttoimgbot
- Create a venv
python -m venv venv
venv/Scripts/activate.ps1
- Install the requirements.txt
pip install -r requirements.txt
- Download the stable diffusion repository for the bot
huggingface-cli login
git clone https://huggingface.co/CompVis/stable-diffusion-v1-4
# or if you have less than 8 GB RAM/need FP16 for some other reason
huggingface-cli login
git clone --branch fp16 https://huggingface.co/CompVis/stable-diffusion-v1-4
- Copy example.env to just .env ; then open .env
cp example.env .env
notepad .env
- Create the Slack app for your team at https://api.slack.com/apps by importing the slack_manifest.yml
- Install to your workspace under OAuth in Slack. Copy the xobb value to set SLACK_BOT_TOKEN= in the .env
- In Slack App management, open basic information and copy signing secret to the SLACK_SIGNING_SECRET= in .env
- Further down in basic information generate an App-level token and copy it to the SLACK_APP_TOKEN= in the .env file
- You can now run the bot. If you get an error, remember to activate the venv with venv/Scripts/activate.ps1
python bot.py
SD_IMG_WIDTH and SD_IMG_HEIGHT
Set the generated image size. One should be no more than 512 and both should be a multiple of 8
SD_PRECISION
Set to fp16 for lower precision to save VRAM on cards with less VRAM such as a GTX 1070 or GTX 3060
SD_MODEL_PATH
Relative path to the downloaded stable diffusion model. There should be a model_index.json inside the folder
SD_MODEL_AUTH_TOKEN
Authentication token to access the model from hugging-face. See https://huggingface.co/settings/tokens to generate one
SD_BENCHMARK
Set to false to not run a generation benchmark when running the bot. It will default to saying give 45 seconds for image to be generated
SD_GUIDANCE_SCALE
Defaults to 7.5; set higher to have less variance in images/more strongly correlated images
SD_ITERATIONS
Defaults to 50; set higher for higher quality images with slower generation
SD_NEGATIVE_PROMPT
Set to words you want to avoid such as low-res
SD_SCHEDULER
Change the scheduler. Defaults to DDIM. Valid options are LMS, PNDM, and KARRASVE.