Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,21 +1,69 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
def
|
4 |
-
#
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
# Define the interface with multiple inputs
|
11 |
demo = gr.Interface(
|
12 |
-
fn=
|
13 |
inputs=[
|
14 |
-
gr.Textbox(label="Name", value="Alex Thompson"),
|
15 |
-
gr.Textbox(label="Email", value="alex.thompson@email.com"),
|
16 |
-
gr.Textbox(label="Favorite Color", value="Blue")
|
17 |
],
|
18 |
-
outputs="
|
|
|
|
|
|
|
19 |
)
|
20 |
|
21 |
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
import random
|
3 |
|
4 |
+
def create_story(name, email, favorite_color):
|
5 |
+
# List of story templates with placeholders
|
6 |
+
story_templates = [
|
7 |
+
f"""Dear {name},
|
8 |
+
|
9 |
+
In a world where emails floated like butterflies through digital clouds,
|
10 |
+
{email} stood out as uniquely special. Its owner, a person with an
|
11 |
+
extraordinary affinity for the color {favorite_color}, was about to
|
12 |
+
embark on an unexpected adventure.
|
13 |
+
|
14 |
+
One day, while wearing their favorite {favorite_color} sweater, {name}
|
15 |
+
received a mysterious message. The sender? A secret society of color
|
16 |
+
enthusiasts known as the Chromatic Chamber. They had been watching,
|
17 |
+
noting how {name}'s appreciation for {favorite_color} brought vibrancy
|
18 |
+
to an otherwise ordinary world.
|
19 |
+
|
20 |
+
And so began {name}'s journey into a world where colors came alive...""",
|
21 |
+
|
22 |
+
f"""Breaking News from the Daily Chronicle:
|
23 |
+
|
24 |
+
Local resident {name} ({email}) made headlines today after discovering
|
25 |
+
that their dreams appear exclusively in shades of {favorite_color}.
|
26 |
+
Experts are baffled by this unprecedented phenomenon, which began last
|
27 |
+
Tuesday during an afternoon nap.
|
28 |
+
|
29 |
+
"I've never seen anything quite like it," said Dr. Color, leading
|
30 |
+
chromatic psychologist. "It's as if {name}'s subconscious has developed
|
31 |
+
a particular fondness for {favorite_color}."
|
32 |
+
|
33 |
+
More updates to follow...""",
|
34 |
+
|
35 |
+
f"""Welcome to Your Personal Color Story!
|
36 |
+
|
37 |
+
Name: {name}
|
38 |
+
Email: {email}
|
39 |
+
The Color That Changes Everything: {favorite_color}
|
40 |
+
|
41 |
+
Chapter 1: The {favorite_color} Awakening
|
42 |
+
|
43 |
+
It all started when {name} noticed that every time they checked
|
44 |
+
{email}, their computer screen would flicker with a subtle
|
45 |
+
{favorite_color} glow. At first, they thought it was just a coincidence,
|
46 |
+
but then the neighbors started reporting strange {favorite_color} lights
|
47 |
+
in the sky above their house...
|
48 |
+
|
49 |
+
To be continued..."""
|
50 |
+
]
|
51 |
+
|
52 |
+
# Randomly select one story template
|
53 |
+
return random.choice(story_templates)
|
54 |
|
55 |
# Define the interface with multiple inputs
|
56 |
demo = gr.Interface(
|
57 |
+
fn=create_story,
|
58 |
inputs=[
|
59 |
+
gr.Textbox(label="Name", value="Alex Thompson"),
|
60 |
+
gr.Textbox(label="Email", value="alex.thompson@email.com"),
|
61 |
+
gr.Textbox(label="Favorite Color", value="Blue")
|
62 |
],
|
63 |
+
outputs=gr.Textbox(label="Your Personal Story", lines=10),
|
64 |
+
title="Personal Story Generator",
|
65 |
+
description="Enter your details to generate a unique story featuring you!",
|
66 |
+
theme="default"
|
67 |
)
|
68 |
|
69 |
demo.launch()
|