shorts work
This commit is contained in:
parent
a206a1103c
commit
1aacd87547
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -1,5 +1,8 @@
|
||||||
*.png
|
*.png
|
||||||
.env
|
.env
|
||||||
.session
|
*.session
|
||||||
vscode/
|
vscode/
|
||||||
venv/
|
venv/
|
||||||
|
*.session-journal
|
||||||
|
logs/stable_diff_telegram_bot.log
|
||||||
|
*.session
|
||||||
|
|
18
main.py
18
main.py
|
@ -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()
|
||||||
|
payload[key] = value
|
||||||
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
|
|
||||||
|
|
||||||
last_index += value_end_index
|
last_index += value_end_index
|
||||||
else:
|
else:
|
||||||
prompt.append(f"{key}:")
|
prompt.append(f"{key}:")
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
pyrogram==1.4.16
|
pyrogram
|
||||||
requests
|
requests
|
||||||
tgcrypto==1.2.2
|
tgcrypto==1.2.2
|
||||||
Pillow
|
Pillow
|
||||||
|
|
Loading…
Reference in New Issue
Block a user