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
74c5f797
Commit
74c5f797
authored
Sep 14, 2022
by
jtkelm2
Committed by
AUTOMATIC1111
Sep 14, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added selected image saving
parent
0cfbd59d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
3 deletions
+12
-3
shared.py
modules/shared.py
+2
-1
ui.py
modules/ui.py
+10
-2
No files found.
modules/shared.py
View file @
74c5f797
...
@@ -110,7 +110,8 @@ class Options:
...
@@ -110,7 +110,8 @@ class Options:
"outdir_txt2img_grids"
:
OptionInfo
(
"outputs/txt2img-grids"
,
'Output directory for txt2img grids'
,
component_args
=
hide_dirs
),
"outdir_txt2img_grids"
:
OptionInfo
(
"outputs/txt2img-grids"
,
'Output directory for txt2img grids'
,
component_args
=
hide_dirs
),
"outdir_img2img_grids"
:
OptionInfo
(
"outputs/img2img-grids"
,
'Output directory for img2img grids'
,
component_args
=
hide_dirs
),
"outdir_img2img_grids"
:
OptionInfo
(
"outputs/img2img-grids"
,
'Output directory for img2img grids'
,
component_args
=
hide_dirs
),
"outdir_save"
:
OptionInfo
(
"log/images"
,
"Directory for saving images using the Save button"
,
component_args
=
hide_dirs
),
"outdir_save"
:
OptionInfo
(
"log/images"
,
"Directory for saving images using the Save button"
,
component_args
=
hide_dirs
),
"samples_save"
:
OptionInfo
(
True
,
"Save indiviual samples"
),
"samples_save"
:
OptionInfo
(
True
,
"Save individual samples"
),
"save_selected_only"
:
OptionInfo
(
False
,
"Save selected image only, not entire job"
),
"samples_format"
:
OptionInfo
(
'png'
,
'File format for individual samples'
),
"samples_format"
:
OptionInfo
(
'png'
,
'File format for individual samples'
),
"filter_nsfw"
:
OptionInfo
(
False
,
"Filter NSFW content"
),
"filter_nsfw"
:
OptionInfo
(
False
,
"Filter NSFW content"
),
"grid_save"
:
OptionInfo
(
True
,
"Save image grids"
),
"grid_save"
:
OptionInfo
(
True
,
"Save image grids"
),
...
...
modules/ui.py
View file @
74c5f797
...
@@ -79,16 +79,20 @@ def send_gradio_gallery_to_image(x):
...
@@ -79,16 +79,20 @@ def send_gradio_gallery_to_image(x):
return
image_from_url_text
(
x
[
0
])
return
image_from_url_text
(
x
[
0
])
def
save_files
(
js_data
,
images
,
index
):
def
save_files
(
js_data
,
images
):
import
csv
import
csv
os
.
makedirs
(
opts
.
outdir_save
,
exist_ok
=
True
)
os
.
makedirs
(
opts
.
outdir_save
,
exist_ok
=
True
)
filenames
=
[]
filenames
=
[]
data
=
json
.
loads
(
js_data
)
data
=
json
.
loads
(
js_data
)
if
index
>
-
1
and
opts
.
save_selected_only
and
len
(
images
)
>
1
and
(
index
>
0
or
not
opts
.
return_grid
):
# ensures we are looking at a specific picture, we have save_selected_only, and there's more than a single image (for correct seed logging in case of return_grid)
images
=
[
images
[
index
]]
data
[
"seed"
]
+=
(
index
-
1
if
opts
.
return_grid
else
index
)
with
open
(
os
.
path
.
join
(
opts
.
outdir_save
,
"log.csv"
),
"a"
,
encoding
=
"utf8"
,
newline
=
''
)
as
file
:
with
open
(
os
.
path
.
join
(
opts
.
outdir_save
,
"log.csv"
),
"a"
,
encoding
=
"utf8"
,
newline
=
''
)
as
file
:
at_start
=
file
.
tell
()
==
0
at_start
=
file
.
tell
()
==
0
writer
=
csv
.
writer
(
file
)
writer
=
csv
.
writer
(
file
)
...
@@ -348,9 +352,11 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
...
@@ -348,9 +352,11 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
save
.
click
(
save
.
click
(
fn
=
wrap_gradio_call
(
save_files
),
fn
=
wrap_gradio_call
(
save_files
),
_js
=
"(x, y, z) => [x, y, selected_gallery_index()]"
,
inputs
=
[
inputs
=
[
generation_info
,
generation_info
,
txt2img_gallery
,
txt2img_gallery
,
html_info
],
],
outputs
=
[
outputs
=
[
html_info
,
html_info
,
...
@@ -568,9 +574,11 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
...
@@ -568,9 +574,11 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
save
.
click
(
save
.
click
(
fn
=
wrap_gradio_call
(
save_files
),
fn
=
wrap_gradio_call
(
save_files
),
_js
=
"(x, y, z) => [x, y, selected_gallery_index()]"
,
inputs
=
[
inputs
=
[
generation_info
,
generation_info
,
img2img_gallery
,
img2img_gallery
,
html_info
],
],
outputs
=
[
outputs
=
[
html_info
,
html_info
,
...
...
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