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
7201d940
Commit
7201d940
authored
Apr 03, 2023
by
space-nuko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve frontend responsiveness for some buttons
parent
22bcc7be
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
4 deletions
+54
-4
javascript/ui.js
javascript/ui.js
+48
-0
modules/ui.py
modules/ui.py
+6
-4
No files found.
javascript/ui.js
View file @
7201d940
...
@@ -361,3 +361,51 @@ function selectCheckpoint(name){
...
@@ -361,3 +361,51 @@ function selectCheckpoint(name){
desiredCheckpointName
=
name
;
desiredCheckpointName
=
name
;
gradioApp
().
getElementById
(
'
change_checkpoint
'
).
click
()
gradioApp
().
getElementById
(
'
change_checkpoint
'
).
click
()
}
}
function
setRandomSeed
(
target_interface
)
{
let
seed
=
gradioApp
().
querySelector
(
`#
${
target_interface
}
_seed input`
);
if
(
!
seed
)
{
return
[];
}
seed
.
value
=
"
-1
"
;
seed
.
dispatchEvent
(
new
Event
(
"
input
"
));
return
[];
}
function
setRandomSubseed
(
target_interface
)
{
let
subseed
=
gradioApp
().
querySelector
(
`#
${
target_interface
}
_subseed input`
);
if
(
!
subseed
)
{
return
[];
}
subseed
.
value
=
"
-1
"
;
subseed
.
dispatchEvent
(
new
Event
(
"
input
"
));
return
[];
}
function
switchWidthHeightTxt2Img
()
{
let
width
=
gradioApp
().
querySelector
(
"
#txt2img_width input[type=number]
"
);
let
height
=
gradioApp
().
querySelector
(
"
#txt2img_height input[type=number]
"
);
if
(
!
width
||
!
height
)
{
return
[];
}
let
tmp
=
width
.
value
;
width
.
value
=
height
.
value
;
height
.
value
=
tmp
;
width
.
dispatchEvent
(
new
Event
(
"
input
"
));
height
.
dispatchEvent
(
new
Event
(
"
input
"
));
return
[];
}
function
switchWidthHeightImg2Img
()
{
let
width
=
gradioApp
().
querySelector
(
"
#img2img_width input[type=number]
"
);
let
height
=
gradioApp
().
querySelector
(
"
#img2img_height input[type=number]
"
);
if
(
!
width
||
!
height
)
{
return
[];
}
let
tmp
=
width
.
value
;
width
.
value
=
height
.
value
;
height
.
value
=
tmp
;
width
.
dispatchEvent
(
new
Event
(
"
input
"
));
height
.
dispatchEvent
(
new
Event
(
"
input
"
));
return
[];
}
modules/ui.py
View file @
7201d940
...
@@ -192,8 +192,9 @@ def create_seed_inputs(target_interface):
...
@@ -192,8 +192,9 @@ def create_seed_inputs(target_interface):
seed_resize_from_w
=
gr
.
Slider
(
minimum
=
0
,
maximum
=
2048
,
step
=
8
,
label
=
"Resize seed from width"
,
value
=
0
,
elem_id
=
target_interface
+
'_seed_resize_from_w'
)
seed_resize_from_w
=
gr
.
Slider
(
minimum
=
0
,
maximum
=
2048
,
step
=
8
,
label
=
"Resize seed from width"
,
value
=
0
,
elem_id
=
target_interface
+
'_seed_resize_from_w'
)
seed_resize_from_h
=
gr
.
Slider
(
minimum
=
0
,
maximum
=
2048
,
step
=
8
,
label
=
"Resize seed from height"
,
value
=
0
,
elem_id
=
target_interface
+
'_seed_resize_from_h'
)
seed_resize_from_h
=
gr
.
Slider
(
minimum
=
0
,
maximum
=
2048
,
step
=
8
,
label
=
"Resize seed from height"
,
value
=
0
,
elem_id
=
target_interface
+
'_seed_resize_from_h'
)
random_seed
.
click
(
fn
=
lambda
:
-
1
,
show_progress
=
False
,
inputs
=
[],
outputs
=
[
seed
])
target_interface_state
=
gr
.
Textbox
(
target_interface
,
visible
=
False
)
random_subseed
.
click
(
fn
=
lambda
:
-
1
,
show_progress
=
False
,
inputs
=
[],
outputs
=
[
subseed
])
random_seed
.
click
(
fn
=
None
,
_js
=
"setRandomSeed"
,
show_progress
=
False
,
inputs
=
[
target_interface_state
],
outputs
=
[])
random_subseed
.
click
(
fn
=
None
,
_js
=
"setRandomSubseed"
,
show_progress
=
False
,
inputs
=
[
target_interface_state
],
outputs
=
[])
def
change_visibility
(
show
):
def
change_visibility
(
show
):
return
{
comp
:
gr_show
(
show
)
for
comp
in
seed_extras
}
return
{
comp
:
gr_show
(
show
)
for
comp
in
seed_extras
}
...
@@ -576,7 +577,7 @@ def create_ui():
...
@@ -576,7 +577,7 @@ def create_ui():
txt2img_prompt
.
submit
(
**
txt2img_args
)
txt2img_prompt
.
submit
(
**
txt2img_args
)
submit
.
click
(
**
txt2img_args
)
submit
.
click
(
**
txt2img_args
)
res_switch_btn
.
click
(
lambda
w
,
h
:
(
h
,
w
),
inputs
=
[
width
,
height
],
outputs
=
[
width
,
height
]
,
show_progress
=
False
)
res_switch_btn
.
click
(
fn
=
None
,
_js
=
"switchWidthHeightTxt2Img"
,
inputs
=
None
,
outputs
=
None
,
show_progress
=
False
)
txt_prompt_img
.
change
(
txt_prompt_img
.
change
(
fn
=
modules
.
images
.
image_data
,
fn
=
modules
.
images
.
image_data
,
...
@@ -896,7 +897,8 @@ def create_ui():
...
@@ -896,7 +897,8 @@ def create_ui():
img2img_prompt
.
submit
(
**
img2img_args
)
img2img_prompt
.
submit
(
**
img2img_args
)
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
(
fn
=
None
,
_js
=
"switchWidthHeightImg2Img"
,
inputs
=
None
,
outputs
=
None
,
show_progress
=
False
)
img2img_interrogate
.
click
(
img2img_interrogate
.
click
(
fn
=
lambda
*
args
:
process_interrogate
(
interrogate
,
*
args
),
fn
=
lambda
*
args
:
process_interrogate
(
interrogate
,
*
args
),
...
...
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