Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -12,11 +12,11 @@ def respond(
|
|
12 |
message,
|
13 |
history: list[tuple[str, str]],
|
14 |
system_message,
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
max_tokens,
|
21 |
temperature,
|
22 |
top_p,
|
@@ -24,15 +24,15 @@ def respond(
|
|
24 |
# Construct the system message with additional inputs
|
25 |
enhanced_system_message = (
|
26 |
f"{system_message}\n\n"
|
27 |
-
f"
|
28 |
-
f"
|
29 |
-
f"
|
30 |
-
f"
|
31 |
)
|
32 |
|
33 |
-
# If the user wants
|
34 |
-
if
|
35 |
-
enhanced_system_message += "The user is also asking for
|
36 |
|
37 |
messages = [{"role": "system", "content": enhanced_system_message}]
|
38 |
|
@@ -65,20 +65,20 @@ demo = gr.ChatInterface(
|
|
65 |
respond,
|
66 |
additional_inputs=[
|
67 |
gr.Textbox(
|
68 |
-
value="You are a friendly Chatbot, a digital marketing expert and a talented copywriter. You are trying to help a user write a creative
|
69 |
label="Instructions to Bot",
|
70 |
),
|
71 |
-
gr.Textbox(label="Your Customer Profile", placeholder="Describe your customer
|
72 |
gr.Textbox(
|
73 |
-
label="
|
74 |
-
placeholder="Describe your
|
75 |
),
|
76 |
gr.Textbox(
|
77 |
-
label="
|
78 |
-
placeholder="Describe your
|
79 |
),
|
80 |
-
gr.Textbox(label="
|
81 |
-
gr.Checkbox(label="Ask for
|
82 |
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
83 |
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
84 |
gr.Slider(
|
@@ -89,8 +89,8 @@ demo = gr.ChatInterface(
|
|
89 |
label="Top-p (nucleus sampling)",
|
90 |
),
|
91 |
],
|
92 |
-
title="
|
93 |
-
description="This app
|
94 |
)
|
95 |
|
96 |
|
|
|
12 |
message,
|
13 |
history: list[tuple[str, str]],
|
14 |
system_message,
|
15 |
+
segment_profile,
|
16 |
+
value_proposition,
|
17 |
+
promotion,
|
18 |
+
subject,
|
19 |
+
ask_for_subject_suggestions,
|
20 |
max_tokens,
|
21 |
temperature,
|
22 |
top_p,
|
|
|
24 |
# Construct the system message with additional inputs
|
25 |
enhanced_system_message = (
|
26 |
f"{system_message}\n\n"
|
27 |
+
f"Segment Profile: {segment_profile}\n"
|
28 |
+
f"Value Proposition: {value_proposition}\n"
|
29 |
+
f"Goal and Promotion: {promotion}\n"
|
30 |
+
f"Subject Line: {subject}\n"
|
31 |
)
|
32 |
|
33 |
+
# If the user wants Subject Line suggestions, modify the prompt
|
34 |
+
if ask_for_subject_suggestions:
|
35 |
+
enhanced_system_message += "The user is also asking for subject line suggestion to catch their customer's attention and improve Email Open Rate."
|
36 |
|
37 |
messages = [{"role": "system", "content": enhanced_system_message}]
|
38 |
|
|
|
65 |
respond,
|
66 |
additional_inputs=[
|
67 |
gr.Textbox(
|
68 |
+
value="You are a friendly Chatbot, a digital marketing expert and a talented copywriter. You are trying to help a user write a creative email that can achieve campaign goals, a high Open Rate, CTR and conversion rate - based on user input.",
|
69 |
label="Instructions to Bot",
|
70 |
),
|
71 |
+
gr.Textbox(label="Your Target Customer Segment Profile", placeholder="Describe the profile of your target customer segment (e.g., age, gender, interests, profession)"),
|
72 |
gr.Textbox(
|
73 |
+
label="Your Value Proposition",
|
74 |
+
placeholder="Describe how your solution to customer problems offers them unique value",
|
75 |
),
|
76 |
gr.Textbox(
|
77 |
+
label="Campaign Goal, Special Event, Promotion and Call to Action",
|
78 |
+
placeholder="Describe your campaign goal, a special event, promotion and Call to Action that you hope your target segment will act upon",
|
79 |
),
|
80 |
+
gr.Textbox(label="Subject Line", placeholder="Enter the Subject Line of the Email or ask for suggestions"),
|
81 |
+
gr.Checkbox(label="Ask for Subject Line Suggestions", value=False),
|
82 |
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
83 |
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
84 |
gr.Slider(
|
|
|
89 |
label="Top-p (nucleus sampling)",
|
90 |
),
|
91 |
],
|
92 |
+
title="Email Copywriter",
|
93 |
+
description="This app creates a customized email that resonates with your customers to improve CTR and conversion. Based on your input. Powered by Hugging Face Inference, Design Thinking, and domain expertise. Expand Additional Inputs by clicking on the arrow, input more details about your customers, then a message describing what you need the assistant to do for you. Developed by wn. Disclaimer: AI makes mistakes. Use with caution and at your own risk!",
|
94 |
)
|
95 |
|
96 |
|