import gradio as gr import html def greet(name): return "Hello " + name + "!!" css = """ #generate { height: 100%; } """ with gr.Blocks(css=css) as demo: with gr.Tab("PNG Info"): def plaintext_to_html(text, classname=None): content = "
\n".join(html.escape(x) for x in text.split('\n')) return f"

{content}

" if classname else f"

{content}

" def get_exif_data(image): items = image.info info = '' for key, text in items.items(): info += f"""

{plaintext_to_html(str(key))}

{plaintext_to_html(str(text))}

""".strip() + "\n" if len(info) == 0: message = "Nothing found in the image." info = f"

{message}

" return info with gr.Row(): with gr.Column(): image_input = gr.Image(type="pil") with gr.Column(): exif_output = gr.HTML(label="EXIF Data") image_input.upload(get_exif_data, inputs=[image_input], outputs=exif_output) demo.launch()