Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
S
stable-diffusion-webui
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
stable-diffusion-webui
Commits
3992ecbe
Commit
3992ecbe
authored
Jan 06, 2023
by
Mitchell Boot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added UI elements
Added a new row to hires fix that shows the new resolution after scaling
parent
874b975b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
ui.py
modules/ui.py
+12
-0
No files found.
modules/ui.py
View file @
3992ecbe
...
...
@@ -255,6 +255,12 @@ def add_style(name: str, prompt: str, negative_prompt: str):
return
[
gr
.
Dropdown
.
update
(
visible
=
True
,
choices
=
list
(
shared
.
prompt_styles
.
styles
))
for
_
in
range
(
4
)]
def
calc_resolution_hires
(
x
,
y
,
scale
):
#final res can only be a multiple of 8
scaled_x
=
int
(
x
*
scale
//
8
)
*
8
scaled_y
=
int
(
y
*
scale
//
8
)
*
8
return
"<p style='margin: -1em 0em 0.7em 1.35em'>Upscaled Resolution: "
+
str
(
scaled_x
)
+
"x"
+
str
(
scaled_y
)
+
"</p>"
def
apply_styles
(
prompt
,
prompt_neg
,
style1_name
,
style2_name
):
prompt
=
shared
.
prompt_styles
.
apply_styles_to_prompt
(
prompt
,
[
style1_name
,
style2_name
])
...
...
@@ -718,6 +724,12 @@ def create_ui():
hr_scale
=
gr
.
Slider
(
minimum
=
1.0
,
maximum
=
4.0
,
step
=
0.05
,
label
=
"Upscale by"
,
value
=
2.0
,
elem_id
=
"txt2img_hr_scale"
)
hr_resize_x
=
gr
.
Slider
(
minimum
=
0
,
maximum
=
2048
,
step
=
8
,
label
=
"Resize width to"
,
value
=
0
,
elem_id
=
"txt2img_hr_resize_x"
)
hr_resize_y
=
gr
.
Slider
(
minimum
=
0
,
maximum
=
2048
,
step
=
8
,
label
=
"Resize height to"
,
value
=
0
,
elem_id
=
"txt2img_hr_resize_y"
)
with
FormRow
(
elem_id
=
"txt2img_hires_fix_row3"
):
hr_final_resolution
=
gr
.
HTML
(
value
=
calc_resolution_hires
(
width
.
value
,
height
.
value
,
hr_scale
.
value
),
elem_id
=
"txtimg_hr_finalres"
)
hr_scale
.
change
(
fn
=
calc_resolution_hires
,
inputs
=
[
width
,
height
,
hr_scale
],
outputs
=
hr_final_resolution
,
show_progress
=
False
)
width
.
change
(
fn
=
calc_resolution_hires
,
inputs
=
[
width
,
height
,
hr_scale
],
outputs
=
hr_final_resolution
,
show_progress
=
False
)
height
.
change
(
fn
=
calc_resolution_hires
,
inputs
=
[
width
,
height
,
hr_scale
],
outputs
=
hr_final_resolution
,
show_progress
=
False
)
elif
category
==
"batch"
:
if
not
opts
.
dimensions_and_batch_together
:
...
...
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