Spaces:
Runtime error
Runtime error
AdityaBolt commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,16 +1,20 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
-
def
|
|
|
|
| 4 |
greetings = {
|
| 5 |
"friendly": "Hey there",
|
| 6 |
"formal": "Dear",
|
| 7 |
"funny": "What's up"
|
| 8 |
}
|
|
|
|
|
|
|
| 9 |
body_text = f"{greetings[tone]} {name},\n\n" \
|
| 10 |
-
"I just wanted to drop you a note because I heard it's your " \
|
| 11 |
-
|
| 12 |
"I hope your day is filled with laughter, joy, and cake! Lots of cake! π\n\n"
|
| 13 |
|
|
|
|
| 14 |
if tone == "friendly":
|
| 15 |
closing = "Catch you later,\n- Your buddy"
|
| 16 |
elif tone == "formal":
|
|
@@ -18,9 +22,11 @@ def write_letter(name, occasion, tone, emoji_count):
|
|
| 18 |
else: # funny
|
| 19 |
closing = "Stay awesome (I know you will),\n- Your coolest friend"
|
| 20 |
|
|
|
|
| 21 |
emojis = "π" * emoji_count
|
| 22 |
return body_text + closing + "\n" + emojis
|
| 23 |
|
|
|
|
| 24 |
inputs = [
|
| 25 |
gr.inputs.Textbox(lines=2, label="Name"),
|
| 26 |
gr.inputs.Textbox(lines=2, label="Occasion"),
|
|
@@ -30,6 +36,9 @@ inputs = [
|
|
| 30 |
|
| 31 |
output = gr.outputs.Textbox(label="Your Personalized Letter")
|
| 32 |
|
| 33 |
-
iface = gr.Interface(fn=write_letter, inputs=inputs, outputs=output, title="Create Your Personalized Letter", description="Fill in the details below to generate your personalized letter. Have fun!")
|
| 34 |
|
| 35 |
-
iface.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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":
|
|
|
|
| 22 |
else: # 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.inputs.Textbox(lines=2, label="Name"),
|
| 32 |
gr.inputs.Textbox(lines=2, label="Occasion"),
|
|
|
|
| 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 |
+
iface.launch()
|