Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -37,22 +37,46 @@ def email_interface(name, subject, recipient, recipient_info):
|
|
| 37 |
structured_info = structure_info(recipient_info)
|
| 38 |
return generate_email(name, subject, recipient, structured_info)
|
| 39 |
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
if __name__ == "__main__":
|
| 58 |
demo.launch()
|
|
|
|
| 37 |
structured_info = structure_info(recipient_info)
|
| 38 |
return generate_email(name, subject, recipient, structured_info)
|
| 39 |
|
| 40 |
+
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
| 41 |
+
gr.Markdown(
|
| 42 |
+
"""
|
| 43 |
+
# 📧 EmailGenie
|
| 44 |
+
Generate personalized emails based on recipient information using AI.
|
| 45 |
+
"""
|
| 46 |
+
)
|
| 47 |
+
|
| 48 |
+
with gr.Row():
|
| 49 |
+
with gr.Column(scale=1):
|
| 50 |
+
name = gr.Textbox(label="Your Name", placeholder="John Doe")
|
| 51 |
+
subject = gr.Textbox(label="Email Subject", placeholder="Collaboration on AI Project")
|
| 52 |
+
with gr.Column(scale=1):
|
| 53 |
+
recipient = gr.Textbox(label="Recipient Name/Company", placeholder="TechCorp")
|
| 54 |
+
recipient_info = gr.Textbox(
|
| 55 |
+
label="Recipient Information",
|
| 56 |
+
placeholder="e.g., Name, Motive, What they do",
|
| 57 |
+
lines=3
|
| 58 |
+
)
|
| 59 |
+
|
| 60 |
+
generate_button = gr.Button("Generate Email", variant="primary")
|
| 61 |
+
|
| 62 |
+
output = gr.Textbox(label="Generated Email", lines=10)
|
| 63 |
+
|
| 64 |
+
generate_button.click(
|
| 65 |
+
email_interface,
|
| 66 |
+
inputs=[name, subject, recipient, recipient_info],
|
| 67 |
+
outputs=output
|
| 68 |
+
)
|
| 69 |
+
|
| 70 |
+
gr.Examples(
|
| 71 |
+
[
|
| 72 |
+
["John Doe", "Collaboration on AI Project", "TechCorp", "TechCorp is a leading AI research company focused on developing cutting-edge machine learning algorithms."],
|
| 73 |
+
["Jane Smith", "AI Workshop Invitation", "Dr. Alex Johnson", "Dr. Alex Johnson is a renowned AI researcher specializing in natural language processing at Stanford University."]
|
| 74 |
+
],
|
| 75 |
+
inputs=[name, subject, recipient, recipient_info],
|
| 76 |
+
outputs=output,
|
| 77 |
+
fn=email_interface,
|
| 78 |
+
cache_examples=True,
|
| 79 |
+
)
|
| 80 |
|
| 81 |
if __name__ == "__main__":
|
| 82 |
demo.launch()
|