- Local install of stable-diffusion-webui
- In the webui, navigate to
Settings -> Saving images/grids -> Enable 'Create a text file next to every image with generation parameters.' -> Apply settings
. - Warning: If you do not do the previous step, the prompt content and the image will not be sent to the webhook.
- Libraries: os, time, requests.
- Also run pip install discord-webhook
- Download webhook.py
- Right click -> edit file.
- Paste your Discord webhook URL into DISCORD_WEBHOOK_URL, and paste the path to txt2img-images in IMAGES_PARENT_FOLDER. (I haven't tested changing the parent folder to the whole output dir, but you are welcome to give it a whirl. As it is, this script is written to upload txt2img-images output).
- Navigate to the main stable-diffusion-webui folder.
- Place webhook.py in this directory.
- Right click on webui.bat -> edit file.
- Go down to
:launch
and delete everything between that andpause
. Then paste this into that spot.
echo Running webhook.py
start "" %PYTHON% webhook.py
echo Running launch.py
%PYTHON% launch.py %*
- Run webui.bat
- All images generated in txt2img-images will be uploaded to the webhook.
The first time the script is run, it will create a file in the parent dir called file_list.txt
. It will run through all the files in the parent folder's subdirectories, and collect all file names. These file names will be added to the txt file, and every time the script runs, it will grab all of the file names and compare them to the existing file names in the txt file. If any new files exist, it will add them to the txt file and upload them to the webhook. It will also check if any text files exist with the same name as the image file. If the text file exists (containing the prompt info) it will send that to the webhook as well. If file names exist in the txt file, but not any subdirectories, they will be removed from the txt file.
- DISCORD_WEBHOOK_URL: The URL of the Discord webhook.
- IMAGES_PARENT_FOLDER: The parent folder where the images will be uploaded to.
- IMAGE_FILE_EXT: The file extension of the images to upload.
- FILE_LIST_PATH: The file path to the file list text file.