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
90366b8d
Commit
90366b8d
authored
Mar 29, 2023
by
siutin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tool button
parent
e0b58527
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
9 deletions
+10
-9
javascript/hints.js
javascript/hints.js
+1
-1
modules/ui.py
modules/ui.py
+9
-8
No files found.
javascript/hints.js
View file @
90366b8d
...
@@ -22,7 +22,7 @@ titles = {
...
@@ -22,7 +22,7 @@ titles = {
"
\
u{1f4cb}
"
:
"
Apply selected styles to current prompt
"
,
"
\
u{1f4cb}
"
:
"
Apply selected styles to current prompt
"
,
"
\
u{1f4d2}
"
:
"
Paste available values into the field
"
,
"
\
u{1f4d2}
"
:
"
Paste available values into the field
"
,
"
\
u{1f3b4}
"
:
"
Show/hide extra networks
"
,
"
\
u{1f3b4}
"
:
"
Show/hide extra networks
"
,
"
\
u{1F300}
"
:
"
Restore progress
"
,
"
Inpaint a part of image
"
:
"
Draw a mask over an image, and the script will regenerate the masked area with content according to prompt
"
,
"
Inpaint a part of image
"
:
"
Draw a mask over an image, and the script will regenerate the masked area with content according to prompt
"
,
"
SD upscale
"
:
"
Upscale image normally, split result into tiles, improve each tile using img2img, merge whole image back
"
,
"
SD upscale
"
:
"
Upscale image normally, split result into tiles, improve each tile using img2img, merge whole image back
"
,
...
...
modules/ui.py
View file @
90366b8d
...
@@ -82,6 +82,7 @@ apply_style_symbol = '\U0001f4cb' # 📋
...
@@ -82,6 +82,7 @@ apply_style_symbol = '\U0001f4cb' # 📋
clear_prompt_symbol
=
'
\U0001f5d1\ufe0f
'
# 🗑️
clear_prompt_symbol
=
'
\U0001f5d1\ufe0f
'
# 🗑️
extra_networks_symbol
=
'
\U0001F3B4
'
# 🎴
extra_networks_symbol
=
'
\U0001F3B4
'
# 🎴
switch_values_symbol
=
'
\U000021C5
'
# ⇅
switch_values_symbol
=
'
\U000021C5
'
# ⇅
restore_progress_symbol
=
'
\U0001F300
'
# 🌀
def
plaintext_to_html
(
text
):
def
plaintext_to_html
(
text
):
...
@@ -294,7 +295,6 @@ def create_toprow(is_img2img):
...
@@ -294,7 +295,6 @@ def create_toprow(is_img2img):
interrupt
=
gr
.
Button
(
'Interrupt'
,
elem_id
=
f
"{id_part}_interrupt"
,
elem_classes
=
"generate-box-interrupt"
)
interrupt
=
gr
.
Button
(
'Interrupt'
,
elem_id
=
f
"{id_part}_interrupt"
,
elem_classes
=
"generate-box-interrupt"
)
skip
=
gr
.
Button
(
'Skip'
,
elem_id
=
f
"{id_part}_skip"
,
elem_classes
=
"generate-box-skip"
)
skip
=
gr
.
Button
(
'Skip'
,
elem_id
=
f
"{id_part}_skip"
,
elem_classes
=
"generate-box-skip"
)
submit
=
gr
.
Button
(
'Generate'
,
elem_id
=
f
"{id_part}_generate"
,
variant
=
'primary'
)
submit
=
gr
.
Button
(
'Generate'
,
elem_id
=
f
"{id_part}_generate"
,
variant
=
'primary'
)
restore_progress
=
gr
.
Button
(
'Restore Progress'
,
elem_id
=
f
"{id_part}_restore_progress"
)
skip
.
click
(
skip
.
click
(
fn
=
lambda
:
shared
.
state
.
skip
(),
fn
=
lambda
:
shared
.
state
.
skip
(),
...
@@ -314,6 +314,7 @@ def create_toprow(is_img2img):
...
@@ -314,6 +314,7 @@ def create_toprow(is_img2img):
extra_networks_button
=
ToolButton
(
value
=
extra_networks_symbol
,
elem_id
=
f
"{id_part}_extra_networks"
)
extra_networks_button
=
ToolButton
(
value
=
extra_networks_symbol
,
elem_id
=
f
"{id_part}_extra_networks"
)
prompt_style_apply
=
ToolButton
(
value
=
apply_style_symbol
,
elem_id
=
f
"{id_part}_style_apply"
)
prompt_style_apply
=
ToolButton
(
value
=
apply_style_symbol
,
elem_id
=
f
"{id_part}_style_apply"
)
save_style
=
ToolButton
(
value
=
save_style_symbol
,
elem_id
=
f
"{id_part}_style_create"
)
save_style
=
ToolButton
(
value
=
save_style_symbol
,
elem_id
=
f
"{id_part}_style_create"
)
restore_progress_button
=
ToolButton
(
value
=
restore_progress_symbol
,
elem_id
=
f
"{id_part}_restore_progress"
)
token_counter
=
gr
.
HTML
(
value
=
"<span>0/75</span>"
,
elem_id
=
f
"{id_part}_token_counter"
,
elem_classes
=
[
"token-counter"
])
token_counter
=
gr
.
HTML
(
value
=
"<span>0/75</span>"
,
elem_id
=
f
"{id_part}_token_counter"
,
elem_classes
=
[
"token-counter"
])
token_button
=
gr
.
Button
(
visible
=
False
,
elem_id
=
f
"{id_part}_token_button"
)
token_button
=
gr
.
Button
(
visible
=
False
,
elem_id
=
f
"{id_part}_token_button"
)
...
@@ -331,7 +332,7 @@ def create_toprow(is_img2img):
...
@@ -331,7 +332,7 @@ def create_toprow(is_img2img):
prompt_styles
=
gr
.
Dropdown
(
label
=
"Styles"
,
elem_id
=
f
"{id_part}_styles"
,
choices
=
[
k
for
k
,
v
in
shared
.
prompt_styles
.
styles
.
items
()],
value
=
[],
multiselect
=
True
)
prompt_styles
=
gr
.
Dropdown
(
label
=
"Styles"
,
elem_id
=
f
"{id_part}_styles"
,
choices
=
[
k
for
k
,
v
in
shared
.
prompt_styles
.
styles
.
items
()],
value
=
[],
multiselect
=
True
)
create_refresh_button
(
prompt_styles
,
shared
.
prompt_styles
.
reload
,
lambda
:
{
"choices"
:
[
k
for
k
,
v
in
shared
.
prompt_styles
.
styles
.
items
()]},
f
"refresh_{id_part}_styles"
)
create_refresh_button
(
prompt_styles
,
shared
.
prompt_styles
.
reload
,
lambda
:
{
"choices"
:
[
k
for
k
,
v
in
shared
.
prompt_styles
.
styles
.
items
()]},
f
"refresh_{id_part}_styles"
)
return
prompt
,
prompt_styles
,
negative_prompt
,
submit
,
restore_progress
,
button_interrogate
,
button_deepbooru
,
prompt_style_apply
,
save_style
,
paste
,
extra_networks_button
,
token_counter
,
token_button
,
negative_token_counter
,
negative_token
_button
return
prompt
,
prompt_styles
,
negative_prompt
,
submit
,
button_interrogate
,
button_deepbooru
,
prompt_style_apply
,
save_style
,
paste
,
extra_networks_button
,
token_counter
,
token_button
,
negative_token_counter
,
negative_token_button
,
restore_progress
_button
def
setup_progressbar
(
*
args
,
**
kwargs
):
def
setup_progressbar
(
*
args
,
**
kwargs
):
...
@@ -448,7 +449,7 @@ def create_ui():
...
@@ -448,7 +449,7 @@ def create_ui():
modules
.
scripts
.
scripts_txt2img
.
initialize_scripts
(
is_img2img
=
False
)
modules
.
scripts
.
scripts_txt2img
.
initialize_scripts
(
is_img2img
=
False
)
with
gr
.
Blocks
(
analytics_enabled
=
False
)
as
txt2img_interface
:
with
gr
.
Blocks
(
analytics_enabled
=
False
)
as
txt2img_interface
:
txt2img_prompt
,
txt2img_prompt_styles
,
txt2img_negative_prompt
,
submit
,
restore_progress
,
_
,
_
,
txt2img_prompt_style_apply
,
txt2img_save_style
,
txt2img_paste
,
extra_networks_button
,
token_counter
,
token_button
,
negative_token_counter
,
negative_token
_button
=
create_toprow
(
is_img2img
=
False
)
txt2img_prompt
,
txt2img_prompt_styles
,
txt2img_negative_prompt
,
submit
,
_
,
_
,
txt2img_prompt_style_apply
,
txt2img_save_style
,
txt2img_paste
,
extra_networks_button
,
token_counter
,
token_button
,
negative_token_counter
,
negative_token_button
,
restore_progress
_button
=
create_toprow
(
is_img2img
=
False
)
dummy_component
=
gr
.
Label
(
visible
=
False
)
dummy_component
=
gr
.
Label
(
visible
=
False
)
txt_prompt_img
=
gr
.
File
(
label
=
""
,
elem_id
=
"txt2img_prompt_image"
,
file_count
=
"single"
,
type
=
"binary"
,
visible
=
False
)
txt_prompt_img
=
gr
.
File
(
label
=
""
,
elem_id
=
"txt2img_prompt_image"
,
file_count
=
"single"
,
type
=
"binary"
,
visible
=
False
)
...
@@ -580,8 +581,8 @@ def create_ui():
...
@@ -580,8 +581,8 @@ def create_ui():
res_switch_btn
.
click
(
lambda
w
,
h
:
(
h
,
w
),
inputs
=
[
width
,
height
],
outputs
=
[
width
,
height
],
show_progress
=
False
)
res_switch_btn
.
click
(
lambda
w
,
h
:
(
h
,
w
),
inputs
=
[
width
,
height
],
outputs
=
[
width
,
height
],
show_progress
=
False
)
restore_progress
.
click
(
restore_progress
_button
.
click
(
fn
=
lambda
:
restore_progress_call
(
'txt2img'
),
fn
=
lambda
:
restore_progress_call
(),
_js
=
"() => restoreProgress('txt2img')"
,
_js
=
"() => restoreProgress('txt2img')"
,
inputs
=
[],
inputs
=
[],
outputs
=
[
outputs
=
[
...
@@ -660,7 +661,7 @@ def create_ui():
...
@@ -660,7 +661,7 @@ def create_ui():
modules
.
scripts
.
scripts_img2img
.
initialize_scripts
(
is_img2img
=
True
)
modules
.
scripts
.
scripts_img2img
.
initialize_scripts
(
is_img2img
=
True
)
with
gr
.
Blocks
(
analytics_enabled
=
False
)
as
img2img_interface
:
with
gr
.
Blocks
(
analytics_enabled
=
False
)
as
img2img_interface
:
img2img_prompt
,
img2img_prompt_styles
,
img2img_negative_prompt
,
submit
,
restore_progress
,
img2img_interrogate
,
img2img_deepbooru
,
img2img_prompt_style_apply
,
img2img_save_style
,
img2img_paste
,
extra_networks_button
,
token_counter
,
token_button
,
negative_token_counter
,
negative_token
_button
=
create_toprow
(
is_img2img
=
True
)
img2img_prompt
,
img2img_prompt_styles
,
img2img_negative_prompt
,
submit
,
img2img_interrogate
,
img2img_deepbooru
,
img2img_prompt_style_apply
,
img2img_save_style
,
img2img_paste
,
extra_networks_button
,
token_counter
,
token_button
,
negative_token_counter
,
negative_token_button
,
restore_progress
_button
=
create_toprow
(
is_img2img
=
True
)
img2img_prompt_img
=
gr
.
File
(
label
=
""
,
elem_id
=
"img2img_prompt_image"
,
file_count
=
"single"
,
type
=
"binary"
,
visible
=
False
)
img2img_prompt_img
=
gr
.
File
(
label
=
""
,
elem_id
=
"img2img_prompt_image"
,
file_count
=
"single"
,
type
=
"binary"
,
visible
=
False
)
...
@@ -912,8 +913,8 @@ def create_ui():
...
@@ -912,8 +913,8 @@ def create_ui():
submit
.
click
(
**
img2img_args
)
submit
.
click
(
**
img2img_args
)
res_switch_btn
.
click
(
lambda
w
,
h
:
(
h
,
w
),
inputs
=
[
width
,
height
],
outputs
=
[
width
,
height
],
show_progress
=
False
)
res_switch_btn
.
click
(
lambda
w
,
h
:
(
h
,
w
),
inputs
=
[
width
,
height
],
outputs
=
[
width
,
height
],
show_progress
=
False
)
restore_progress
.
click
(
restore_progress
_button
.
click
(
fn
=
lambda
:
restore_progress_call
(
'img2img'
),
fn
=
lambda
:
restore_progress_call
(),
_js
=
"() => restoreProgress('img2img')"
,
_js
=
"() => restoreProgress('img2img')"
,
inputs
=
[],
inputs
=
[],
outputs
=
[
outputs
=
[
...
...
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