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
ef75c980
Commit
ef75c980
authored
Jan 10, 2023
by
AUTOMATIC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Split history ui.py to ui_progress.py
parent
54dd5d66
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1924 deletions
+9
-1924
modules/ui.py
modules/ui.py
+3
-91
modules/ui_progress.py
modules/ui_progress.py
+6
-1833
No files found.
modules/ui.py
View file @
ef75c980
...
...
@@ -162,79 +162,6 @@ def save_files(js_data, images, do_make_zip, index):
return
gr
.
File
.
update
(
value
=
fullfns
,
visible
=
True
),
plaintext_to_html
(
f
"Saved: {filenames[0]}"
)
def
calc_time_left
(
progress
,
threshold
,
label
,
force_display
,
show_eta
):
if
progress
==
0
:
return
""
else
:
time_since_start
=
time
.
time
()
-
shared
.
state
.
time_start
eta
=
(
time_since_start
/
progress
)
eta_relative
=
eta
-
time_since_start
if
(
eta_relative
>
threshold
and
show_eta
)
or
force_display
:
if
eta_relative
>
3600
:
return
label
+
time
.
strftime
(
'
%
H:
%
M:
%
S'
,
time
.
gmtime
(
eta_relative
))
elif
eta_relative
>
60
:
return
label
+
time
.
strftime
(
'
%
M:
%
S'
,
time
.
gmtime
(
eta_relative
))
else
:
return
label
+
time
.
strftime
(
'
%
Ss'
,
time
.
gmtime
(
eta_relative
))
else
:
return
""
def
check_progress_call
(
id_part
):
if
shared
.
state
.
job_count
==
0
:
return
""
,
gr_show
(
False
),
gr_show
(
False
),
gr_show
(
False
)
progress
=
0
if
shared
.
state
.
job_count
>
0
:
progress
+=
shared
.
state
.
job_no
/
shared
.
state
.
job_count
if
shared
.
state
.
sampling_steps
>
0
:
progress
+=
1
/
shared
.
state
.
job_count
*
shared
.
state
.
sampling_step
/
shared
.
state
.
sampling_steps
# Show progress percentage and time left at the same moment, and base it also on steps done
show_eta
=
progress
>=
0.01
or
shared
.
state
.
sampling_step
>=
10
time_left
=
calc_time_left
(
progress
,
1
,
" ETA: "
,
shared
.
state
.
time_left_force_display
,
show_eta
)
if
time_left
!=
""
:
shared
.
state
.
time_left_force_display
=
True
progress
=
min
(
progress
,
1
)
progressbar
=
""
if
opts
.
show_progressbar
:
progressbar
=
f
"""<div class='progressDiv'><div class='progress' style="overflow:visible;width:{progress * 100}
%
;white-space:nowrap;">{" " * 2 + str(int(progress*100))+"
%
" + time_left if show_eta else ""}</div></div>"""
image
=
gr_show
(
False
)
preview_visibility
=
gr_show
(
False
)
if
opts
.
show_progress_every_n_steps
!=
0
:
shared
.
state
.
set_current_image
()
image
=
shared
.
state
.
current_image
if
image
is
None
:
image
=
gr
.
update
(
value
=
None
)
else
:
preview_visibility
=
gr_show
(
True
)
if
shared
.
state
.
textinfo
is
not
None
:
textinfo_result
=
gr
.
HTML
.
update
(
value
=
shared
.
state
.
textinfo
,
visible
=
True
)
else
:
textinfo_result
=
gr_show
(
False
)
return
f
"<span id='{id_part}_progress_span' style='display: none'>{time.time()}</span><p>{progressbar}</p>"
,
preview_visibility
,
image
,
textinfo_result
def
check_progress_call_initial
(
id_part
):
shared
.
state
.
job_count
=
-
1
shared
.
state
.
current_latent
=
None
shared
.
state
.
current_image
=
None
shared
.
state
.
textinfo
=
None
shared
.
state
.
time_start
=
time
.
time
()
shared
.
state
.
time_left_force_display
=
False
return
check_progress_call
(
id_part
)
def
visit
(
x
,
func
,
path
=
""
):
if
hasattr
(
x
,
'children'
):
for
c
in
x
.
children
:
...
...
@@ -456,25 +383,10 @@ def create_toprow(is_img2img):
return
prompt
,
prompt_style
,
negative_prompt
,
prompt_style2
,
submit
,
button_interrogate
,
button_deepbooru
,
prompt_style_apply
,
save_style
,
paste
,
token_counter
,
token_button
def
setup_progressbar
(
progressbar
,
preview
,
id_part
,
textinfo
=
None
):
if
textinfo
is
None
:
textinfo
=
gr
.
HTML
(
visible
=
False
)
def
setup_progressbar
(
*
args
,
**
kwargs
):
import
modules.ui_progress
check_progress
=
gr
.
Button
(
'Check progress'
,
elem_id
=
f
"{id_part}_check_progress"
,
visible
=
False
)
check_progress
.
click
(
fn
=
lambda
:
check_progress_call
(
id_part
),
show_progress
=
False
,
inputs
=
[],
outputs
=
[
progressbar
,
preview
,
preview
,
textinfo
],
)
check_progress_initial
=
gr
.
Button
(
'Check progress (first)'
,
elem_id
=
f
"{id_part}_check_progress_initial"
,
visible
=
False
)
check_progress_initial
.
click
(
fn
=
lambda
:
check_progress_call_initial
(
id_part
),
show_progress
=
False
,
inputs
=
[],
outputs
=
[
progressbar
,
preview
,
preview
,
textinfo
],
)
modules
.
ui_progress
.
setup_progressbar
(
*
args
,
**
kwargs
)
def
apply_setting
(
key
,
value
):
...
...
modules/ui_progress.py
View file @
ef75c980
This diff is collapsed.
Click to expand it.
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