|
import gradio as gr |
|
from PIL import Image |
|
|
|
|
|
def show_image(): |
|
image = Image.open('the_peddlers_magic_seeds.jpg') |
|
return image |
|
|
|
|
|
title_button = gr.Button("The Peddler's Magic Seeds") |
|
image_output = gr.Image() |
|
|
|
def display_image(): |
|
return show_image() |
|
|
|
with gr.Blocks() as demo: |
|
gr.Markdown(""" |
|
<h1 style='text-decoration: underline; cursor: pointer;'>The Peddler's Magic Seeds</h1> |
|
<p>Click the title of the story below to look at the image.</p> |
|
""") |
|
title_button.render() |
|
title_button.click(display_image, inputs=None, outputs=image_output) |
|
image_output.render() |
|
|
|
demo.launch() |
|
|