shorts work

This commit is contained in:
tami-p40 2024-05-17 22:24:12 +03:00
parent a206a1103c
commit 1aacd87547
3 changed files with 11 additions and 16 deletions

5
.gitignore vendored
View File

@ -1,5 +1,8 @@
*.png *.png
.env .env
.session *.session
vscode/ vscode/
venv/ venv/
*.session-journal
logs/stable_diff_telegram_bot.log
*.session

16
main.py
View File

@ -65,23 +65,15 @@ def parse_input(input_string):
if last_index != match.start(): if last_index != match.start():
prompt.append(input_string[last_index: match.start()].strip()) prompt.append(input_string[last_index: match.start()].strip())
last_index = value_start_index last_index = value_start_index
if key == "ds":
key = "denoising_strength"
if key == "ng":
key = "negative_prompt"
if key in default_payload: if key in default_payload:
value_end_index = re.search(r"(?=\s+\w+:|$)", input_string[value_start_index:]).start() value_end_index = re.search(r"(?=\s+\w+:|$)", input_string[value_start_index:]).start()
value = input_string[value_start_index: value_start_index + value_end_index].strip() value = input_string[value_start_index: value_start_index + value_end_index].strip()
if key == "denoising_strength":
try:
ds_value = float(value)
if 0.0 <= ds_value <= 1.0:
payload[key] = ds_value
else:
payload[key] = default_payload[key]
except ValueError:
payload[key] = default_payload[key]
else:
payload[key] = value payload[key] = value
last_index += value_end_index last_index += value_end_index
else: else:
prompt.append(f"{key}:") prompt.append(f"{key}:")

View File

@ -1,4 +1,4 @@
pyrogram==1.4.16 pyrogram
requests requests
tgcrypto==1.2.2 tgcrypto==1.2.2
Pillow Pillow