image info tab
* handles exceptions if jpeg jfif data not present * removes further non-comment related exif data.
This commit is contained in:
parent
e49b1c5d73
commit
de5bfdf917
3 changed files with 7 additions and 6 deletions
|
@ -97,7 +97,7 @@ def run_extras(image, image_folder, gfpgan_visibility, codeformer_visibility, co
|
||||||
return outputs, plaintext_to_html(info), ''
|
return outputs, plaintext_to_html(info), ''
|
||||||
|
|
||||||
|
|
||||||
def run_pnginfo(image):
|
def run_image_info(image):
|
||||||
items = image.info
|
items = image.info
|
||||||
|
|
||||||
if "exif" in image.info:
|
if "exif" in image.info:
|
||||||
|
@ -111,8 +111,9 @@ def run_pnginfo(image):
|
||||||
|
|
||||||
items['exif comment'] = exif_comment
|
items['exif comment'] = exif_comment
|
||||||
|
|
||||||
for field in ['jfif', 'jfif_version', 'jfif_unit', 'jfif_density', 'dpi', 'exif']:
|
for field in ['jfif', 'jfif_version', 'jfif_unit', 'jfif_density', 'dpi', 'exif',
|
||||||
del items[field]
|
'loop', 'background', 'timestamp', 'duration']:
|
||||||
|
items.pop(field, None)
|
||||||
|
|
||||||
|
|
||||||
info = ''
|
info = ''
|
||||||
|
|
|
@ -295,7 +295,7 @@ def create_toprow(is_img2img):
|
||||||
return prompt, roll, prompt_style, negative_prompt, prompt_style2, submit, interrogate, prompt_style_apply, save_style, check_progress
|
return prompt, roll, prompt_style, negative_prompt, prompt_style2, submit, interrogate, prompt_style_apply, save_style, check_progress
|
||||||
|
|
||||||
|
|
||||||
def create_ui(txt2img, img2img, run_extras, run_pnginfo):
|
def create_ui(txt2img, img2img, run_extras, run_image_info):
|
||||||
with gr.Blocks(analytics_enabled=False) as txt2img_interface:
|
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, check_progress = create_toprow(is_img2img=False)
|
txt2img_prompt, roll, txt2img_prompt_style, txt2img_negative_prompt, txt2img_prompt_style2, submit, _, txt2img_prompt_style_apply, txt2img_save_style, check_progress = create_toprow(is_img2img=False)
|
||||||
|
|
||||||
|
@ -697,7 +697,7 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
|
||||||
submit.click(**extras_args)
|
submit.click(**extras_args)
|
||||||
|
|
||||||
pnginfo_interface = gr.Interface(
|
pnginfo_interface = gr.Interface(
|
||||||
wrap_gradio_call(run_pnginfo),
|
wrap_gradio_call(run_image_info),
|
||||||
inputs=[
|
inputs=[
|
||||||
gr.Image(label="Source", source="upload", interactive=True, type="pil"),
|
gr.Image(label="Source", source="upload", interactive=True, type="pil"),
|
||||||
],
|
],
|
||||||
|
|
2
webui.py
2
webui.py
|
@ -121,7 +121,7 @@ def webui():
|
||||||
txt2img=wrap_gradio_gpu_call(modules.txt2img.txt2img),
|
txt2img=wrap_gradio_gpu_call(modules.txt2img.txt2img),
|
||||||
img2img=wrap_gradio_gpu_call(modules.img2img.img2img),
|
img2img=wrap_gradio_gpu_call(modules.img2img.img2img),
|
||||||
run_extras=wrap_gradio_gpu_call(modules.extras.run_extras),
|
run_extras=wrap_gradio_gpu_call(modules.extras.run_extras),
|
||||||
run_pnginfo=modules.extras.run_pnginfo
|
run_image_info=modules.extras.run_image_info
|
||||||
)
|
)
|
||||||
|
|
||||||
demo.launch(
|
demo.launch(
|
||||||
|
|
Loading…
Reference in a new issue