Spaces:
Build error
Build error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from PIL import Image
|
| 3 |
+
|
| 4 |
+
# Summary and video URL
|
| 5 |
+
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."""
|
| 6 |
+
|
| 7 |
+
# Replace 'story_image.jpg' with the actual filename of the uploaded image
|
| 8 |
+
image_path = "story_image.jpg"
|
| 9 |
+
video_url = "https://ai.invideo.io/watch/O5Q4fOeVnoH"
|
| 10 |
+
|
| 11 |
+
# Function to load image
|
| 12 |
+
def load_image(path):
|
| 13 |
+
img = Image.open(path)
|
| 14 |
+
return img
|
| 15 |
+
|
| 16 |
+
# Gradio interface
|
| 17 |
+
with gr.Blocks() as demo:
|
| 18 |
+
gr.Markdown("# The Peddler's Magic Seeds - Summary and Video")
|
| 19 |
+
|
| 20 |
+
# Display the story summary
|
| 21 |
+
gr.Markdown("### Story Summary")
|
| 22 |
+
gr.Markdown(summary)
|
| 23 |
+
|
| 24 |
+
# Display the story image
|
| 25 |
+
gr.Markdown("### Story Image")
|
| 26 |
+
story_image = load_image(image_path)
|
| 27 |
+
gr.Image(story_image)
|
| 28 |
+
|
| 29 |
+
# Display the video
|
| 30 |
+
gr.Markdown("### Watch the Story Video")
|
| 31 |
+
video_html = f'<iframe src="{video_url}" width="560" height="315" frameborder="0" allowfullscreen></iframe>'
|
| 32 |
+
gr.HTML(video_html)
|
| 33 |
+
|
| 34 |
+
demo.launch()
|