Spaces:
Runtime error
Runtime error
AdityaBolt commited on
Update app.py
Browse files
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":
|
| 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.
|
| 32 |
-
gr.
|
| 33 |
-
gr.
|
| 34 |
-
gr.
|
| 35 |
]
|
| 36 |
|
| 37 |
-
|
| 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()
|