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
3c6a049f
Commit
3c6a049f
authored
Sep 30, 2022
by
Liam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
consolidated token counter functions
parent
ff8dc190
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
15 deletions
+12
-15
javascript/ui.js
javascript/ui.js
+9
-12
modules/ui.py
modules/ui.py
+3
-3
No files found.
javascript/ui.js
View file @
3c6a049f
...
...
@@ -199,21 +199,18 @@ let txt2img_textarea, img2img_textarea = undefined;
let
wait_time
=
800
let
token_timeout
;
function
roll_artist_txt2img
(
prompt_text
)
{
function
update_txt2img_tokens
(...
args
)
{
update_token_counter
(
"
txt2img_token_button
"
)
return
prompt_text
;
if
(
args
.
length
==
2
)
return
args
[
0
]
return
args
;
}
function
roll_artist_img2img
(
prompt_text
)
{
update_token_counter
(
"
img2img_token_button
"
)
return
prompt_text
;
}
function
update_style_txt2img
(
prompt_text
,
negative_prompt
,
style1
,
style2
)
{
update_token_counter
(
"
txt2img_token_button
"
)
return
[
prompt_text
,
negative_prompt
,
style1
,
style2
]
}
function
update_style_img2img
(
prompt_text
,
negative_prompt
,
style1
,
style2
)
{
function
update_img2img_tokens
(...
args
)
{
update_token_counter
(
"
img2img_token_button
"
)
return
[
prompt_text
,
negative_prompt
,
style1
,
style2
]
if
(
args
.
length
==
2
)
return
args
[
0
]
return
args
;
}
function
update_token_counter
(
button_id
)
{
...
...
modules/ui.py
View file @
3c6a049f
...
...
@@ -543,7 +543,7 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo, run_modelmerger):
roll
.
click
(
fn
=
roll_artist
,
_js
=
"
roll_artist_txt2img
"
,
_js
=
"
update_txt2img_tokens
"
,
inputs
=
[
txt2img_prompt
,
],
...
...
@@ -749,7 +749,7 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo, run_modelmerger):
roll
.
click
(
fn
=
roll_artist
,
_js
=
"
roll_artist_img2img
"
,
_js
=
"
update_img2img_tokens
"
,
inputs
=
[
img2img_prompt
,
],
...
...
@@ -760,7 +760,7 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo, run_modelmerger):
prompts
=
[(
txt2img_prompt
,
txt2img_negative_prompt
),
(
img2img_prompt
,
img2img_negative_prompt
)]
style_dropdowns
=
[(
txt2img_prompt_style
,
txt2img_prompt_style2
),
(
img2img_prompt_style
,
img2img_prompt_style2
)]
style_js_funcs
=
[
"update_
style_txt2img"
,
"update_style_img2img
"
]
style_js_funcs
=
[
"update_
txt2img_tokens"
,
"update_img2img_tokens
"
]
for
button
,
(
prompt
,
negative_prompt
)
in
zip
([
txt2img_save_style
,
img2img_save_style
],
prompts
):
button
.
click
(
...
...
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