Spaces:
Sleeping
Sleeping
import gradio as gr | |
import random | |
def create_story(name, email, favorite_color): | |
# List of story templates with placeholders | |
story_templates = [ | |
f"""Dear {name}, | |
In a world where emails floated like butterflies through digital clouds, | |
{email} stood out as uniquely special. Its owner, a person with an | |
extraordinary affinity for the color {favorite_color}, was about to | |
embark on an unexpected adventure. | |
One day, while wearing their favorite {favorite_color} sweater, {name} | |
received a mysterious message. The sender? A secret society of color | |
enthusiasts known as the Chromatic Chamber. They had been watching, | |
noting how {name}'s appreciation for {favorite_color} brought vibrancy | |
to an otherwise ordinary world. | |
And so began {name}'s journey into a world where colors came alive...""", | |
f"""Breaking News from the Daily Chronicle: | |
Local resident {name} ({email}) made headlines today after discovering | |
that their dreams appear exclusively in shades of {favorite_color}. | |
Experts are baffled by this unprecedented phenomenon, which began last | |
Tuesday during an afternoon nap. | |
"I've never seen anything quite like it," said Dr. Color, leading | |
chromatic psychologist. "It's as if {name}'s subconscious has developed | |
a particular fondness for {favorite_color}." | |
More updates to follow...""", | |
f"""Welcome to Your Personal Color Story! | |
Name: {name} | |
Email: {email} | |
The Color That Changes Everything: {favorite_color} | |
Chapter 1: The {favorite_color} Awakening | |
It all started when {name} noticed that every time they checked | |
{email}, their computer screen would flicker with a subtle | |
{favorite_color} glow. At first, they thought it was just a coincidence, | |
but then the neighbors started reporting strange {favorite_color} lights | |
in the sky above their house... | |
To be continued...""" | |
] | |
# Randomly select one story template | |
return random.choice(story_templates) | |
# Define the interface with multiple inputs | |
demo = gr.Interface( | |
fn=create_story, | |
inputs=[ | |
gr.Textbox(label="Name", value="Alex Thompson"), | |
gr.Textbox(label="Email", value="alex.thompson@email.com"), | |
gr.Textbox(label="Favorite Color", value="Blue") | |
], | |
outputs=gr.Textbox(label="Your Personal Story", lines=10), | |
title="Personal Story Generator", | |
description="Enter your details to generate a unique story featuring you!", | |
theme="default" | |
) | |
demo.launch() |