adding .env template and update readme
This commit is contained in:
parent
e0107336d3
commit
ec813f571e
4
.env_template
Normal file
4
.env_template
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
TOKEN=<telegram-bot-token >
|
||||||
|
API_ID=<telegram-id-api-id >
|
||||||
|
API_HASH=<telegram-id-api-hash>
|
||||||
|
SD_URL=<stable-diffusion-api-url>
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
||||||
*.png
|
*.png
|
||||||
.env
|
.env
|
||||||
.session
|
.session
|
||||||
|
vscode/
|
43
README.md
43
README.md
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
this is a txt2img bot to converse with SDweb bot [API](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/API) running on tami telegram channel
|
this is a txt2img bot to converse with SDweb bot [API](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/API) running on tami telegram channel
|
||||||
|
|
||||||
# How to
|
## How to
|
||||||
|
|
||||||
supported invocation:
|
supported invocation:
|
||||||
`/draw <text>` - send prompt text to the bot and it will draw an image
|
`/draw <text>` - send prompt text to the bot and it will draw an image
|
||||||
|
@ -11,6 +11,7 @@ you can add `denoised intermediate steps` using `steps: <text>`
|
||||||
|
|
||||||
basicly anything the `/controlnet/txt2img` API payload supports
|
basicly anything the `/controlnet/txt2img` API payload supports
|
||||||
like,
|
like,
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"prompt": "",
|
"prompt": "",
|
||||||
|
@ -22,6 +23,7 @@ like,
|
||||||
"cfg_scale": 7
|
"cfg_scale": 7
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
examples:
|
examples:
|
||||||
`/draw a city street`
|
`/draw a city street`
|
||||||
and without people
|
and without people
|
||||||
|
@ -32,26 +34,33 @@ with more steps
|
||||||
to change the model use:
|
to change the model use:
|
||||||
`/getmodels` - to get a list of models and then click to set it.
|
`/getmodels` - to get a list of models and then click to set it.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- note1: Anything after ng will be considered as nergative prompt. a.k.a things you do not want to see in your diffusion!
|
- note1: Anything after ng will be considered as nergative prompt. a.k.a things you do not want to see in your diffusion!
|
||||||
- note2: on [negative_prompt](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Negative-prompt) (aka ng):
|
- note2: on [negative_prompt](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Negative-prompt) (aka ng):
|
||||||
thia is a bit of a black art. i took the recommended defaults for the `Deliberate` model from this fun [alt-model spreadsheet](https://docs.google.com/spreadsheets/d/1Q0bYKRfVOTUHQbUsIISCztpdZXzfo9kOoAy17Qhz3hI/edit#gid=797387129).
|
thia is a bit of a black art. i took the recommended defaults for the `Deliberate` model from this fun [alt-model spreadsheet](https://docs.google.com/spreadsheets/d/1Q0bYKRfVOTUHQbUsIISCztpdZXzfo9kOoAy17Qhz3hI/edit#gid=797387129).
|
||||||
~~and you (currntly) can only ADD to it, not replace.~~
|
~~and you (currntly) can only ADD to it, not replace.~~
|
||||||
- note3: on `steps` - step of 1 will generate only the first "step" of bot hallucinations. the default is 40. higher will take longer and will give "better" image. range is hardcoded 1-70.
|
- note3: on `steps` - step of 1 will generate only the first "step" of bot hallucinations. the default is 40. higher will take longer and will give "better" image. range is hardcoded 1-70.
|
||||||
see ![video](https://user-images.githubusercontent.com/57876960/212490617-f0444799-50e5-485e-bc5d-9c24a9146d38.mp4)
|
see ![video](https://user-images.githubusercontent.com/57876960/212490617-f0444799-50e5-485e-bc5d-9c24a9146d38.mp4)
|
||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
|
|
||||||
Install requirements
|
Install requirements using venv
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python3 -m venv venv
|
||||||
|
source venv/bin/activate
|
||||||
|
pip install -r requirements.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Install requirements using conda
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
conda create -n sdw python=3.8
|
conda create -n sdw python=3.8
|
||||||
conda activate sdw
|
conda activate sdw
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
```
|
```
|
||||||
(note: conda is not strictly necessary, but it is recommended)
|
|
||||||
|
|
||||||
## Original readme
|
## Original README
|
||||||
|
|
||||||
My Bot uses [Automatic1111's WebUI](https://github.com/AUTOMATIC1111/stable-diffusion-webui) as the backend.
|
My Bot uses [Automatic1111's WebUI](https://github.com/AUTOMATIC1111/stable-diffusion-webui) as the backend.
|
||||||
Follow the directions on their repo for setup instructions.
|
Follow the directions on their repo for setup instructions.
|
||||||
|
@ -62,15 +71,23 @@ arguments such as `--xformers` to use xformers memory efficient attention.
|
||||||
You can use the web ui interface that Automatic1111 provides to select the model and VAE to use.
|
You can use the web ui interface that Automatic1111 provides to select the model and VAE to use.
|
||||||
Their repo has documentation on how to do so. I also recommend doing a test generation
|
Their repo has documentation on how to do so. I also recommend doing a test generation
|
||||||
|
|
||||||
Create a file called `.env` in the same folder as `main.py`. Inside the `.env` file,
|
Copy a file called `.env_template` into `.env_template` in the same folder as `main.py`.
|
||||||
create a line `TOKEN = xxxx`, where xxxx is your telegram bot token.
|
In the `.env` file fill out the following environment variables:
|
||||||
create a line `API_ID = xxxx`, where xxxx is your telegram id api id.
|
`TOKEN = xxxx`, where xxxx is your telegram bot token.
|
||||||
create a line `API_HASH = xxxx`, where xxxx is your telegram id api hash.
|
`API_ID = xxxx`, where xxxx is your telegram id api id.
|
||||||
create a line `SD_URL = xxxx`, where xxxx is your sd api url.
|
`API_HASH = xxxx`, where xxxx is your telegram id api hash.
|
||||||
|
`SD_URL = xxxx`, where xxxx is your sd api url.
|
||||||
|
|
||||||
|
|
||||||
|
To get the API_ID and API_HASH, you need to create a new application on the Telegram's developer website. Here are the steps:
|
||||||
|
|
||||||
|
1. Open browser and visit https://my.telegram.org and log in with your Telegram account.
|
||||||
|
2. Click on "API development tools".
|
||||||
|
3. Fill out the form to create a new application. You can enter any valid details you want.
|
||||||
|
4. After you've created the application, you'll be given the API_ID and API_HASH.
|
||||||
|
5. Once you have these, you can add them to your .env file:
|
||||||
|
|
||||||
Now, you can run the bot
|
Now, you can run the bot
|
||||||
|
|
||||||
`python main.py`
|
`python main.py`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
3
main.py
3
main.py
|
@ -12,7 +12,8 @@ from dotenv import load_dotenv
|
||||||
|
|
||||||
# Done! Congratulations on your new bot. You will find it at
|
# Done! Congratulations on your new bot. You will find it at
|
||||||
# t.me/gootmornbot
|
# t.me/gootmornbot
|
||||||
# You can now add a description, about section and profile picture for your bot, see /help for a list of commands. By the way, when you've finished creating your cool bot, ping our Bot Support if you want a better username for it. Just make sure the bot is fully operational before you do this.
|
# You can now add a description, about section and profile picture for your bot, see /help for a list of commands.
|
||||||
|
# By the way, when you've finished creating your cool bot, ping our Bot Support if you want a better username for it. Just make sure the bot is fully operational before you do this.
|
||||||
|
|
||||||
# Use this token to access the HTTP API:
|
# Use this token to access the HTTP API:
|
||||||
# Keep your token secure and store it safely, it can be used by anyone to control your bot.
|
# Keep your token secure and store it safely, it can be used by anyone to control your bot.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user