adriiita commited on
Commit
6bcf519
·
verified ·
1 Parent(s): a17cf11

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +40 -16
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
- demo = gr.Interface(
41
- fn=email_interface,
42
- inputs=[
43
- gr.Textbox(label="Your Name"),
44
- gr.Textbox(label="Email Subject"),
45
- gr.Textbox(label="Recipient Name/Company"),
46
- gr.Textbox(label="Recipient Information (e.g., Name, Motive, What they do)")
47
- ],
48
- outputs="text",
49
- title="EmailGenie",
50
- description="Generate a personalized email based on recipient information",
51
- examples=[
52
- ["John Doe", "Collaboration on AI Project", "TechCorp", "TechCorp is a leading AI research company focused on developing cutting-edge machine learning algorithms."],
53
- ["Jane Smith", "AI Workshop Invitation", "Dr. Alex Johnson", "Dr. Alex Johnson is a renowned AI researcher specializing in natural language processing at Stanford University."]
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()