Update app.py
Browse files
app.py
CHANGED
@@ -19,33 +19,33 @@ def openai_chat(prompt):
|
|
19 |
message = completions.choices[0].text
|
20 |
return message.strip()
|
21 |
|
22 |
-
def build_type_1(content_url,
|
23 |
-
return f"Write a {
|
24 |
|
25 |
-
def build_type_2(content_url,
|
26 |
-
return f"Write a {
|
27 |
|
28 |
-
def build_prod_upgrade_yes(content_url,
|
29 |
-
return f"Write a {
|
30 |
|
31 |
-
def build_prod_upgrade_no(content_url,
|
32 |
-
return f"Write a {
|
33 |
|
34 |
-
def call_email(
|
35 |
if job_role_change=="Yes":
|
36 |
-
if
|
37 |
-
input_agg = build_prod_upgrade_yes(content_url,
|
38 |
else:
|
39 |
-
input_agg = build_type_2(content_url,
|
40 |
elif job_role_change=="No":
|
41 |
-
if
|
42 |
-
input_agg = build_prod_upgrade_no(content_url,
|
43 |
else:
|
44 |
-
input_agg = build_type_1(content_url,
|
45 |
print(input_agg)
|
46 |
output = openai_chat(input_agg)
|
47 |
history=[]
|
48 |
-
history.append((
|
49 |
return history, history
|
50 |
|
51 |
gr.Interface(fn = call_email,
|
|
|
19 |
message = completions.choices[0].text
|
20 |
return message.strip()
|
21 |
|
22 |
+
def build_type_1(content_url, Email_Type, industry,theme, keywords,job_role,prospect_context):
|
23 |
+
return f"Write a {Email_Type} email to sell servicenow product to a prospect in {industry} based on their information extracted from {prospect_context} by analyzing and summarizing this content {content_url} around {keywords} focusing on {theme} and is relevant for job {job_role}"
|
24 |
|
25 |
+
def build_type_2(content_url, Email_Type, industry,theme, keywords,job_role,prospect_context):
|
26 |
+
return f"Write a {Email_Type} email to sell servicenow product to a prospect in {industry} based on their information extracted from {prospect_context} by analyzing and summarizing this content {content_url} around {keywords} focusing on {theme} and is relevant for job {job_role}.Start with congratulating {job_role} for the new role"
|
27 |
|
28 |
+
def build_prod_upgrade_yes(content_url, Email_Type, industry,theme, keywords,job_role,prospect_context):
|
29 |
+
return f"Write a {Email_Type} email to inform on new product update for servicenow to a prospect in {industry} based on their information extracted from {prospect_context} by analyzing and summarizing this content {content_url} around {keywords} focusing on {theme} and is relevant for job {job_role}.Start with congratulating {job_role} for the new role"
|
30 |
|
31 |
+
def build_prod_upgrade_no(content_url, Email_Type, industry,theme, keywords,job_role,prospect_context):
|
32 |
+
return f"Write a {Email_Type} email to inform on new product update for servicenow to a prospect in {industry} based on their information extracted from {prospect_context} by analyzing and summarizing this content {content_url} around {keywords} focusing on {theme} and is relevant for job {job_role}."
|
33 |
|
34 |
+
def call_email(Email_Type,industry,keywords, theme, content_url,job_role_change, job_role,prospect_context, history=[]):
|
35 |
if job_role_change=="Yes":
|
36 |
+
if Email_Type=="Product Upgrade Communication":
|
37 |
+
input_agg = build_prod_upgrade_yes(content_url,Email_Type, industry,theme, keywords, job_role,prospect_context)
|
38 |
else:
|
39 |
+
input_agg = build_type_2(content_url,Email_Type, industry,theme, keywords, job_role,prospect_context)
|
40 |
elif job_role_change=="No":
|
41 |
+
if Email_Type=="Product Upgrade Communication":
|
42 |
+
input_agg = build_prod_upgrade_no(content_url,Email_Type, industry,theme, keywords, job_role,prospect_context)
|
43 |
else:
|
44 |
+
input_agg = build_type_1(content_url,Email_Type, industry,theme, keywords, job_role,prospect_context)
|
45 |
print(input_agg)
|
46 |
output = openai_chat(input_agg)
|
47 |
history=[]
|
48 |
+
history.append((Email_Type, output))
|
49 |
return history, history
|
50 |
|
51 |
gr.Interface(fn = call_email,
|