|
import gradio as gr |
|
from PIL import Image |
|
|
|
|
|
summary = """In a quaint village surrounded by rolling hills, young Tom struggled with the tough soil in his family's garden. One day, a peddler arrived selling various items, including magical seeds. Tom purchased a packet and planted them in his garden. To everyone's surprise, the seeds grew into vibrant and lush plants, transforming the barren garden into a wonder. The remarkable growth of these plants brought the community together, with neighbors sharing seeds and gardening tips. Inspired by the peddler, Tom later became a peddler himself, spreading joy and community spirit by selling magic seeds to other villages. Tom's story became a symbol of how small acts of kindness and curiosity can lead to widespread beauty and unity.""" |
|
|
|
|
|
image_path = "story_image.jpg" |
|
video_url = "https://ai.invideo.io/watch/nSqTRdL6O2D" |
|
|
|
|
|
def load_image(path): |
|
img = Image.open(path) |
|
return img |
|
|
|
|
|
with gr.Blocks() as demo: |
|
gr.Markdown("# The Peddler's Magic Seeds - Summary and Video") |
|
|
|
|
|
gr.Markdown("### Story Summary") |
|
gr.Markdown(summary) |
|
|
|
|
|
gr.Markdown("### Story Image") |
|
story_image = load_image(image_path) |
|
gr.Image(story_image) |
|
|
|
|
|
gr.Markdown("### Watch the Story Video") |
|
video_html = f'<iframe src="{video_url}" width="560" height="315" frameborder="0" allowfullscreen></iframe>' |
|
gr.HTML(video_html) |
|
|
|
demo.launch() |