pleabargain commited on
Commit
3c77cab
·
verified ·
1 Parent(s): 394ae66

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +59 -11
app.py CHANGED
@@ -1,21 +1,69 @@
1
  import gradio as gr
 
2
 
3
- def create_welcome_letter(name, email, favorite_color):
4
- # Create a welcome letter using the provided data
5
- return f"Welcome {name}!\n\n" \
6
- f"We're excited to have you join us. We have your email as {email}, " \
7
- f"and we see that your favorite color is {favorite_color}. " \
8
- f"We hope you enjoy your time with us!"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
  # Define the interface with multiple inputs
11
  demo = gr.Interface(
12
- fn=create_welcome_letter,
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="text"
 
 
 
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()