Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
Stable Diffusion Webui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
novelai-storage
Stable Diffusion Webui
Commits
c9c457ed
Commit
c9c457ed
authored
Sep 09, 2023
by
AUTOMATIC1111
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stylistic changes for #13118
parent
73c2a03d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
modules/ui.py
modules/ui.py
+7
-3
No files found.
modules/ui.py
View file @
c9c457ed
import
datetime
import
functools
import
mimetypes
import
os
import
sys
...
...
@@ -152,7 +151,7 @@ def connect_clear_prompt(button):
)
def
update_token_counter
(
text
,
steps
,
is_positive
=
True
):
def
update_token_counter
(
text
,
steps
,
*
,
is_positive
=
True
):
try
:
text
,
_
=
extra_networks
.
parse_prompt
(
text
)
...
...
@@ -160,6 +159,7 @@ def update_token_counter(text, steps, is_positive=True):
_
,
prompt_flat_list
,
_
=
prompt_parser
.
get_multicond_prompt_list
([
text
])
else
:
prompt_flat_list
=
[
text
]
prompt_schedules
=
prompt_parser
.
get_learned_conditioning_prompt_schedules
(
prompt_flat_list
,
steps
)
except
Exception
:
...
...
@@ -173,6 +173,10 @@ def update_token_counter(text, steps, is_positive=True):
return
f
"<span class='gr-box gr-text-input'>{token_count}/{max_length}</span>"
def
update_negative_prompt_token_counter
(
text
,
steps
):
return
update_token_counter
(
text
,
steps
,
is_positive
=
False
)
class
Toprow
:
"""Creates a top row UI with prompts, generate button, styles, extra little buttons for things, and enables some functionality related to their operation"""
...
...
@@ -539,7 +543,7 @@ def create_ui():
]
toprow
.
token_button
.
click
(
fn
=
wrap_queued_call
(
update_token_counter
),
inputs
=
[
toprow
.
prompt
,
steps
],
outputs
=
[
toprow
.
token_counter
])
toprow
.
negative_token_button
.
click
(
fn
=
wrap_queued_call
(
functools
.
partial
(
update_token_counter
,
is_positive
=
False
)
),
inputs
=
[
toprow
.
negative_prompt
,
steps
],
outputs
=
[
toprow
.
negative_token_counter
])
toprow
.
negative_token_button
.
click
(
fn
=
wrap_queued_call
(
update_negative_prompt_token_counter
),
inputs
=
[
toprow
.
negative_prompt
,
steps
],
outputs
=
[
toprow
.
negative_token_counter
])
extra_networks_ui
=
ui_extra_networks
.
create_ui
(
txt2img_interface
,
[
txt2img_generation_tab
],
'txt2img'
)
ui_extra_networks
.
setup_ui
(
extra_networks_ui
,
txt2img_gallery
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment