File size: 2,446 Bytes
93b20cc
3c77cab
93b20cc
3c77cab
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93b20cc
d7fad04
 
3c77cab
d7fad04
3c77cab
 
 
d7fad04
3c77cab
 
 
 
d7fad04
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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()