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
5967d07d
Commit
5967d07d
authored
Oct 15, 2022
by
AUTOMATIC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix new gradio failing to preserve image params
parent
3631adfe
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
modules/ui.py
modules/ui.py
+18
-0
No files found.
modules/ui.py
View file @
5967d07d
...
@@ -7,6 +7,7 @@ import mimetypes
...
@@ -7,6 +7,7 @@ import mimetypes
import
os
import
os
import
random
import
random
import
sys
import
sys
import
tempfile
import
time
import
time
import
traceback
import
traceback
import
platform
import
platform
...
@@ -176,6 +177,23 @@ def save_files(js_data, images, do_make_zip, index):
...
@@ -176,6 +177,23 @@ 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]}"
)
return
gr
.
File
.
update
(
value
=
fullfns
,
visible
=
True
),
''
,
''
,
plaintext_to_html
(
f
"Saved: {filenames[0]}"
)
def
save_pil_to_file
(
pil_image
,
dir
=
None
):
use_metadata
=
False
metadata
=
PngImagePlugin
.
PngInfo
()
for
key
,
value
in
pil_image
.
info
.
items
():
if
isinstance
(
key
,
str
)
and
isinstance
(
value
,
str
):
metadata
.
add_text
(
key
,
value
)
use_metadata
=
True
file_obj
=
tempfile
.
NamedTemporaryFile
(
delete
=
False
,
suffix
=
".png"
,
dir
=
dir
)
pil_image
.
save
(
file_obj
,
pnginfo
=
(
metadata
if
use_metadata
else
None
))
return
file_obj
# override save to file function so that it also writes PNG info
gr
.
processing_utils
.
save_pil_to_file
=
save_pil_to_file
def
wrap_gradio_call
(
func
,
extra_outputs
=
None
):
def
wrap_gradio_call
(
func
,
extra_outputs
=
None
):
def
f
(
*
args
,
extra_outputs_array
=
extra_outputs
,
**
kwargs
):
def
f
(
*
args
,
extra_outputs_array
=
extra_outputs
,
**
kwargs
):
run_memmon
=
opts
.
memmon_poll_rate
>
0
and
not
shared
.
mem_mon
.
disabled
run_memmon
=
opts
.
memmon_poll_rate
>
0
and
not
shared
.
mem_mon
.
disabled
...
...
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