Skip to content

telegram bot on aiogram python 3.10.6 to generate images in automatic1111 locally

License

Notifications You must be signed in to change notification settings

amputator84/sd_telegram

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 

Repository files navigation

sd_telegram

telegram bot on aiogram python 3.10.6 to generate images in automatic1111 locally

create bot from BotFather and use token in API_TOKEN

the bot is installed in automatic1111 via extensions or use git clone into C:\stable-diffusion-webui\extensions\sd_telegram

pip install aiogram  
pip install webuiapi  
pip install translate  
pip install transformers  
pip install vk_api  
pip install ok_api  
cd C:\stable-diffusion-webui\extensions\sd_telegram\  
python bot.py

use ; in prompt as delimiter to be divided into several separate parts, like cat;dog;car

Commands
start
_SD
__❌ = off, ✅ = on Stable Diffusion
_opt
__sttngs
___change_param
change JSON parameters
img_thumb/img_tg/img_real - little/original from tg/real size from doc
___reset_param
reset to default
___fast_param
reset to my default params
comp, mobile, no hr, big, inc, sdxl, w↔h
__scrpts
___get_lora
get list LORA`s from stable-diffusion-webui/models/Lora
___rnd_mdl
script for generating images for all models in random order, taking into account JSON settings
___rnd_smp
script for generating images for one models with all samplers
___inf
Endless script with random width, height, scale, model, sampler, steps, prompt(1. random-word-api.herokuapp.com/word?lang=en, 2.GPT2Tokenizer, 3. lexica.art/api/v1/search?q=2, 4 = 2 + 3)
If json_prompt = true then run random prompt from json
__mdl
change model from list
__smplr
change sampler from list
__hr
change hr_upscale from list
__prompt
___get
get settings in string
___random_prompt
get random prompt from GPT2Tokenizer FredZhang7 distilgpt2
___lxc_prompt
get random prompt from lexica.art (+ your prompt begin)
_gen
generate images
_skip
skip one or all generations
_help
help

If you send file, view 2 command:
_Lora
_Model

Uploading files to folders:
\models\Stable-diffusion \models\Lora

You upload a file to Telegram, choose what it is and the file automatically goes to the folder. A forwarded message with a file also works.

Please pay attention to the file size limit in Telegram API:
sending-files
senddocument

_Chat History
We go into any Telegram chat with prompts (individual messages), click three dots in the upper right corner, upload only text messages in json format. We get the result.json file, which we throw into the bot and select "Chat History". We get a random prompt, which we can save in data

If you chose /img_real = true, the document will be unloaded for you, and after it the social network VK and OK upload button. Before that, you need to set up a token and enter the ID of the album where the photo will be sent.

drawing

TODO

  1. use share link (not yet possible, because the API is running in the background)
  2. show error in tg
  3. Get all files/pictures from the computer for today (preview and seeds)
  4. Ability to send everything with one command with settings
  5. Preloading photos when waiting for a long time so that you can skip
  6. Progress in script (done with no HR)
  7. Translator capable of translating up to 4000 characters and detecting the language

TNX
AUTOMATIC1111
API
aiogram
And respect for Santa 🎅

Donations are not needed. Who wants to subscribe to my generations

Lifehack`s:
If Lora dont work, see this

© Mishgen

About

telegram bot on aiogram python 3.10.6 to generate images in automatic1111 locally

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages