AdityaBolt commited on
Commit
a77c5f7
ยท
verified ยท
1 Parent(s): 8732399

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +38 -10
app.py CHANGED
@@ -1,13 +1,41 @@
1
  import gradio as gr
2
 
3
- def greet(name):
4
- letter = f"Dear {name},\n\n" \
5
- "I hope this note finds you well. Your smile brightens everyone's day, " \
6
- "and I just wanted to take a moment to tell you how much you mean to those around you. " \
7
- "Keep being your awesome self!\n\n" \
8
- "With lots of love and a huge hug,\n" \
9
- "- Your Friend"
10
- return letter
11
-
12
- iface = gr.Interface(fn=write_letter, inputs="text", outputs="text")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  iface.launch()
 
1
  import gradio as gr
2
 
3
+ def greet(name, occasion, tone, emoji_count):
4
+
5
+ greetings = {
6
+ "friendly": "Hey there",
7
+ "formal": "Dear",
8
+ "funny": "What's up"
9
+ }
10
+
11
+
12
+ body_text = f"{greetings[tone]} {name},\n\n" \
13
+ f"I just wanted to drop you a note because I heard it's your {occasion}. " \
14
+ "What a day to celebrate! ๐ŸŽ‰ " \
15
+ "I hope your day is filled with laughter, joy, and cake! Lots of cake! ๐ŸŽ‚\n\n"
16
+
17
+
18
+ if tone == "friendly":
19
+ closing = "Catch you later,\n- Your buddy"
20
+ elif tone == "formal":
21
+ else: # funny
22
+ closing = "Stay awesome (I know you will),\n- Your coolest friend"
23
+
24
+
25
+ emojis = "๐Ÿ˜Š" * emoji_count
26
+ return body_text + closing + "\n" + emojis
27
+
28
+
29
+ inputs = [
30
+ gr.inputs.Textbox(lines=2, label="Name"),
31
+ gr.inputs.Textbox(lines=2, label="Occasion"),
32
+
33
+ output = gr.outputs.Textbox(label="Your Personalized Letter")
34
+
35
+
36
+
37
+ iface = gr.Interface(fn=write_letter, inputs=inputs, outputs=output,
38
+ title="Create Your Personalized Letter",
39
+ description="Fill in the details below to generate your personalized letter. Have fun!")
40
+
41
  iface.launch()