Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Overbill1683
Stable Diffusion Webui
提交
0aec19d7
S
Stable Diffusion Webui
项目概览
Overbill1683
/
Stable Diffusion Webui
10 个月 前同步成功
通知
1745
Star
81
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
分析
仓库
DevOps
项目成员
Pages
S
Stable Diffusion Webui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Pages
分析
分析
仓库分析
DevOps
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
提交
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
0aec19d7
编写于
10月 14, 2022
作者:
A
AUTOMATIC
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
make pasting into img2img prompt work
make image params request not use temp files
上级
33ae6be5
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
21 addition
and
24 deletion
+21
-24
modules/images.py
modules/images.py
+18
-18
modules/ui.py
modules/ui.py
+3
-6
未找到文件。
modules/images.py
浏览文件 @
0aec19d7
import
datetime
import
io
import
math
import
os
from
collections
import
namedtuple
...
...
@@ -465,21 +466,20 @@ def save_image(image, path, basename, seed=None, prompt=None, extension='png', i
return
fullfn
,
txt_fullfn
def
image_data
(
image_path
):
file
,
ext
=
os
.
path
.
splitext
(
image_path
.
name
)
data
=
{}
if
"png"
in
ext
:
image
=
Image
.
open
(
image_path
.
name
,
"r"
)
print
(
f
"Image data requested for
{
image_path
.
name
}
{
image
.
format
}
of
{
type
(
image
)
}
"
)
try
:
data
=
image
.
text
[
"parameters"
]
except
Exception
as
e
:
print
(
f
"Exception:
{
e
}
"
)
pass
print
(
f
"Image data:
{
data
}
"
)
if
"txt"
in
ext
:
myfile
=
open
(
image_path
.
name
,
'r'
)
data
=
myfile
.
read
()
myfile
.
close
()
return
data
,
None
def
image_data
(
data
):
try
:
image
=
Image
.
open
(
io
.
BytesIO
(
data
))
textinfo
=
image
.
text
[
"parameters"
]
return
textinfo
,
None
except
Exception
:
pass
try
:
text
=
data
.
decode
(
'utf8'
)
assert
len
(
text
)
<
10000
return
text
,
None
except
Exception
:
pass
return
''
,
None
modules/ui.py
浏览文件 @
0aec19d7
...
...
@@ -514,7 +514,7 @@ def create_ui(wrap_gradio_gpu_call):
with
gr
.
Blocks
(
analytics_enabled
=
False
)
as
txt2img_interface
:
txt2img_prompt
,
roll
,
txt2img_prompt_style
,
txt2img_negative_prompt
,
txt2img_prompt_style2
,
submit
,
_
,
_
,
txt2img_prompt_style_apply
,
txt2img_save_style
,
paste
,
token_counter
,
token_button
=
create_toprow
(
is_img2img
=
False
)
dummy_component
=
gr
.
Label
(
visible
=
False
)
txt_prompt_img
=
gr
.
File
(
label
=
""
,
elem_id
=
"txt2img_prompt_image"
,
file_count
=
"single"
,
type
=
"
file
"
,
visible
=
False
)
txt_prompt_img
=
gr
.
File
(
label
=
""
,
elem_id
=
"txt2img_prompt_image"
,
file_count
=
"single"
,
type
=
"
bytes
"
,
visible
=
False
)
with
gr
.
Row
(
elem_id
=
'txt2img_progress_row'
):
with
gr
.
Column
(
scale
=
1
):
...
...
@@ -620,7 +620,6 @@ def create_ui(wrap_gradio_gpu_call):
txt_prompt_img
.
change
(
fn
=
modules
.
images
.
image_data
,
# _js = "get_extras_tab_index",
inputs
=
[
txt_prompt_img
],
...
...
@@ -692,8 +691,7 @@ def create_ui(wrap_gradio_gpu_call):
img2img_prompt
,
roll
,
img2img_prompt_style
,
img2img_negative_prompt
,
img2img_prompt_style2
,
submit
,
img2img_interrogate
,
img2img_deepbooru
,
img2img_prompt_style_apply
,
img2img_save_style
,
paste
,
token_counter
,
token_button
=
create_toprow
(
is_img2img
=
True
)
with
gr
.
Row
(
elem_id
=
'img2img_progress_row'
):
img2img_prompt_img
=
gr
.
File
(
label
=
""
,
elem_id
=
"txt_prompt_image"
,
file_count
=
"single"
,
type
=
"file"
,
visible
=
False
)
img2img_prompt_img
=
gr
.
File
(
label
=
""
,
elem_id
=
"img2img_prompt_image"
,
file_count
=
"single"
,
type
=
"bytes"
,
visible
=
False
)
with
gr
.
Column
(
scale
=
1
):
pass
...
...
@@ -791,9 +789,8 @@ def create_ui(wrap_gradio_gpu_call):
img2img_prompt_img
.
change
(
fn
=
modules
.
images
.
image_data
,
# _js = "get_extras_tab_index",
inputs
=
[
txt
_prompt_img
img2img
_prompt_img
],
outputs
=
[
img2img_prompt
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录