AdityaBolt commited on
Commit
10383da
Β·
verified Β·
1 Parent(s): b092712

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -14
app.py CHANGED
@@ -1,7 +1,6 @@
1
  import gradio as gr
2
 
3
  def greet(name, occasion, tone, emoji_count):
4
- # Base letter content with placeholders
5
  greetings = {
6
  "friendly": "Hey there",
7
  "formal": "Dear",
@@ -13,33 +12,26 @@ def greet(name, occasion, tone, emoji_count):
13
  "What a day to celebrate! πŸŽ‰ " \
14
  "I hope your day is filled with laughter, joy, and cake! Lots of cake! πŸŽ‚\n\n"
15
 
16
-
17
  closing = ""
18
  if tone == "friendly":
19
  closing = "Catch you later,\n- Your buddy"
20
  elif tone == "formal":
21
  closing = "Sincerely,\n- [Your Name Here]"
22
- elif tone == "funny": # corrected the indentation issue here
23
  closing = "Stay awesome (I know you will),\n- Your coolest friend"
24
 
25
-
26
  emojis = "😊" * emoji_count
27
  return body_text + closing + "\n" + emojis
28
 
29
-
30
  inputs = [
31
- gr.inputs.Textbox(lines=2, label="Name"),
32
- gr.inputs.Textbox(lines=2, label="Occasion"),
33
- gr.inputs.Dropdown(choices=["friendly", "formal", "funny"], label="Tone"),
34
- gr.inputs.Slider(minimum=1, maximum=10, default=3, label="Number of Emojis")
35
  ]
36
 
37
- output = gr.outputs.Textbox(label="Your Personalized Letter")
38
-
39
-
40
- iface = gr.Interface(fn=write_letter, inputs=inputs, outputs=output,
41
  title="Create Your Personalized Letter",
42
  description="Fill in the details below to generate your personalized letter. Have fun!")
43
 
44
-
45
  iface.launch()
 
1
  import gradio as gr
2
 
3
  def greet(name, occasion, tone, emoji_count):
 
4
  greetings = {
5
  "friendly": "Hey there",
6
  "formal": "Dear",
 
12
  "What a day to celebrate! πŸŽ‰ " \
13
  "I hope your day is filled with laughter, joy, and cake! Lots of cake! πŸŽ‚\n\n"
14
 
 
15
  closing = ""
16
  if tone == "friendly":
17
  closing = "Catch you later,\n- Your buddy"
18
  elif tone == "formal":
19
  closing = "Sincerely,\n- [Your Name Here]"
20
+ elif tone == "funny":
21
  closing = "Stay awesome (I know you will),\n- Your coolest friend"
22
 
 
23
  emojis = "😊" * emoji_count
24
  return body_text + closing + "\n" + emojis
25
 
 
26
  inputs = [
27
+ gr.Textbox(lines=2, placeholder="Name", label="Name"),
28
+ gr.Textbox(lines=2, placeholder="Occasion", label="Occasion"),
29
+ gr.Dropdown(choices=["friendly", "formal", "funny"], label="Tone"),
30
+ gr.Slider(minimum=1, maximum=10, default=3, label="Number of Emojis")
31
  ]
32
 
33
+ iface = gr.Interface(fn=write_letter, inputs=inputs, outputs="textbox",
 
 
 
34
  title="Create Your Personalized Letter",
35
  description="Fill in the details below to generate your personalized letter. Have fun!")
36
 
 
37
  iface.launch()