sonjil commited on
Commit
2ef24fb
·
verified ·
1 Parent(s): e06d537

Adding the new textfields for the personalised emails

Browse files
Files changed (1) hide show
  1. app.py +22 -6
app.py CHANGED
@@ -23,12 +23,18 @@ chat_completion = client.chat.completions.create(
23
 
24
  print(chat_completion.choices[0].message.content)
25
 
26
- def chat_with_groq(user_input, additional_info=None):
 
 
 
 
 
 
27
  chat_completion = client.chat.completions.create(
28
  messages=[
29
  {
30
  "role": "user",
31
- "content": user_input,
32
  }
33
  ],
34
  model="llama3-8b-8192",
@@ -37,10 +43,20 @@ def chat_with_groq(user_input, additional_info=None):
37
 
38
 
39
  #add UI
40
- iface = gr.ChatInterface(
41
- fn = chat_with_groq,
42
- title="sonjil's ChatBot",
43
- description="ask anything to the sonjil's Groq powered chatbot"
 
 
 
 
 
 
 
 
 
 
44
  )
45
 
46
  if __name__=="__main__":
 
23
 
24
  print(chat_completion.choices[0].message.content)
25
 
26
+ def chat_with_groq(sender_name, receiver_name, about_receiver, project_name, project_details, key_benefits, additional_info=None):
27
+ # Create a more personalized message by including sender, receiver, and additional info
28
+ full_message = (
29
+ f"Compose a personalized email to {receiver_name}, starting with a friendly greeting which include details about the receiver from {about_receiver}. Briefly introduce yourself {sender_name} and express your enthusiasm for sharing details about {project_name}. Describe the {project_details} in a way that highlights its innovative aspects and its potential impact on {receiver_name} or their business. Clearly outline the {key_benefits} of the project, emphasizing how it can address specific challenges or goals that {receiver_name} might have. End the email by inviting {sender_name} to discuss the project further, and provide your contact information [email protected] for follow-up."
30
+
31
+ )
32
+
33
  chat_completion = client.chat.completions.create(
34
  messages=[
35
  {
36
  "role": "user",
37
+ "content": full_message,
38
  }
39
  ],
40
  model="llama3-8b-8192",
 
43
 
44
 
45
  #add UI
46
+ iface = gr.Interface(
47
+ fn=chat_with_groq,
48
+ inputs=[
49
+ gr.Textbox(label="Sender Name"),
50
+ gr.Textbox(label="Receiver Name"),
51
+ gr.Textbox(label="About Receiver"),
52
+ gr.Textbox(label="Project Name"),
53
+ gr.Textbox(label="Project Details"),
54
+ gr.Textbox(label="Key Benefits")
55
+
56
+ ],
57
+ outputs=gr.Textbox(label="Chatbot Response"),
58
+ title="Sonjil's Personalized ChatBot",
59
+ description="Send a personalized email using Sonjil's Groq-powered chatbot"
60
  )
61
 
62
  if __name__=="__main__":