0Learn commited on
Commit
7d28a11
·
verified ·
1 Parent(s): 22aa5ed

added option to write a personalized emai lto sid

Browse files
Files changed (1) hide show
  1. app.py +41 -10
app.py CHANGED
@@ -6,22 +6,53 @@ client = Groq(
6
  api_key=os.environ.get("GROQ_API_KEY"),
7
  )
8
 
9
- def chat_with_groq(user_input, additional_info=None):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  chat_completion = client.chat.completions.create(
11
  messages=[
12
  {
13
- "role":"user",
14
- "content":user_input,
15
-
 
 
 
16
  }
17
  ],
18
  model="llama3-8b-8192",
19
  )
20
  return chat_completion.choices[0].message.content
21
- iface = gr.ChatInterface(
22
- fn=chat_with_groq,
23
- title="Groq Chatbot",
24
- description="Ask anything to the Groq powered chatbot"
25
- )
 
 
 
 
 
 
 
 
26
  if __name__ == "__main__":
27
- iface.launch()
 
6
  api_key=os.environ.get("GROQ_API_KEY"),
7
  )
8
 
9
+ def generate_personalized_email(sender_name, project_name, key_benefits):
10
+ system_prompt = """You are an AI assistant tasked with writing a personalized email to Siddhant Goswami. Here's some information about him:
11
+
12
+ - Co-Founder of 100x Engineers
13
+ - Generative AI Instructor
14
+ - Based in Bengaluru, Karnataka, India
15
+ - Built and scaled three products to seven figures:
16
+ 1. Scenes (acquired by Unacademy)
17
+ 2. Tapchief (acquired by Unacademy)
18
+ 3. Relevel
19
+ - Expertise in Generative AI
20
+
21
+ Write a professional and friendly email to Siddhant based on the provided inputs. The email should be personalized, mentioning his achievements and current role, while also focusing on the sender's project and its benefits."""
22
+
23
+ user_prompt = f"""Generate a personalized email to Siddhant Goswami with the following details:
24
+ - Sender's Name: {sender_name}
25
+ - Project Name: {project_name}
26
+ - Key Benefits: {key_benefits}
27
+
28
+ The email should introduce the sender, briefly describe the project, and highlight its key benefits. Make sure to relate these to Siddhant's experience and interests in Generative AI and entrepreneurship."""
29
+
30
  chat_completion = client.chat.completions.create(
31
  messages=[
32
  {
33
+ "role": "system",
34
+ "content": system_prompt,
35
+ },
36
+ {
37
+ "role": "user",
38
+ "content": user_prompt,
39
  }
40
  ],
41
  model="llama3-8b-8192",
42
  )
43
  return chat_completion.choices[0].message.content
44
+
45
+ iface = gr.Interface(
46
+ fn=generate_personalized_email,
47
+ inputs=[
48
+ gr.Textbox(label="Your Name"),
49
+ gr.Textbox(label="Project Name"),
50
+ gr.Textbox(label="Key Benefits (comma-separated)")
51
+ ],
52
+ outputs=gr.Textbox(label="Generated Email"),
53
+ title="Customizable Email Generator for Siddhant Goswami",
54
+ description="Generate a personalized email to Siddhant Goswami, Co-Founder of 100x Engineers and Generative AI Instructor, by providing your details and project information."
55
+ )
56
+
57
  if __name__ == "__main__":
58
+ iface.launch()