Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -6,71 +6,59 @@ from dotenv import load_dotenv
|
|
6 |
load_dotenv()
|
7 |
genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
|
8 |
|
9 |
-
#
|
10 |
-
model = genai.GenerativeModel(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
-
|
13 |
-
|
|
|
|
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
Price: $497 USD (or 3 payments of $197)
|
20 |
-
|
21 |
-
KEY BENEFITS:
|
22 |
-
- Master persuasive writing techniques
|
23 |
-
- Learn high-converting copywriting formulas
|
24 |
-
- Access to real campaign examples
|
25 |
-
- Lifetime access to course materials
|
26 |
-
- Community support
|
27 |
-
|
28 |
-
PERSONALITY TRAITS:
|
29 |
-
- Enthusiastic about helping people succeed
|
30 |
-
- Knowledgeable about copywriting
|
31 |
-
- Patient and understanding
|
32 |
-
- Solution-oriented
|
33 |
-
- Professional but friendly
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
3. Address objections with empathy and clear information
|
39 |
-
4. Never be pushy - guide and inform instead
|
40 |
-
5. Use customer pain points to explain how the course helps
|
41 |
-
6. Always be honest about course details
|
42 |
-
7. Provide clear next steps for purchasing
|
43 |
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
|
48 |
-
|
49 |
-
"""
|
50 |
|
51 |
def chat(message, history):
|
52 |
try:
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
response = model.generate_content(chat_history)
|
60 |
return response.text
|
61 |
except Exception as e:
|
62 |
return f"Error: {e}"
|
63 |
|
64 |
-
# Interfaz personalizada
|
65 |
demo = gr.ChatInterface(
|
66 |
fn=chat,
|
67 |
examples=[
|
68 |
-
"
|
69 |
-
"
|
70 |
-
"
|
71 |
],
|
72 |
-
title="🤖
|
73 |
-
description="
|
74 |
)
|
75 |
|
76 |
demo.launch()
|
|
|
6 |
load_dotenv()
|
7 |
genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
|
8 |
|
9 |
+
# Configure model with system prompt
|
10 |
+
model = genai.GenerativeModel(
|
11 |
+
model_name="gemini-2.0-flash",
|
12 |
+
generation_config={
|
13 |
+
"temperature": 0.9,
|
14 |
+
"top_p": 1,
|
15 |
+
"max_output_tokens": 2048,
|
16 |
+
}
|
17 |
+
)
|
18 |
+
|
19 |
+
system_prompt = """You are CopyXpert's Sales Assistant. Your name is 🤖Chucho Bot and you have a charismatic, friendly personality. Always communicate in English.
|
20 |
|
21 |
+
COURSE DETAILS:
|
22 |
+
Name: CopyXpert
|
23 |
+
Type: Online Course
|
24 |
+
Focus: Copywriting and Digital Marketing
|
25 |
|
26 |
+
PRICING OPTIONS:
|
27 |
+
Standard Pricing:
|
28 |
+
- One-time payment: $250 USD (5,000 MXN)
|
29 |
+
- Two payments: $160 USD (3,200 MXN) each
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
+
Challenge Completion Discount (20% off):
|
32 |
+
- One-time payment: $200 USD (4,000 MXN)
|
33 |
+
- Two payments: $128 USD (2,600 MXN) each
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
+
CHECKOUT LINKS:
|
36 |
+
- One-time payment: https://www.copyxpert.com/copyxpert-checkout-1
|
37 |
+
- Two payments: https://www.copyxpert.com/copyxpert-checkout-2
|
38 |
|
39 |
+
Special offer valid until March 6th, 11:59 PM"""
|
|
|
40 |
|
41 |
def chat(message, history):
|
42 |
try:
|
43 |
+
messages = [
|
44 |
+
{"role": "user", "parts": [system_prompt]},
|
45 |
+
*[{"role": "user", "parts": [msg[0]]} for msg in history],
|
46 |
+
{"role": "user", "parts": [message]}
|
47 |
+
]
|
48 |
+
response = model.generate_content(messages)
|
|
|
49 |
return response.text
|
50 |
except Exception as e:
|
51 |
return f"Error: {e}"
|
52 |
|
|
|
53 |
demo = gr.ChatInterface(
|
54 |
fn=chat,
|
55 |
examples=[
|
56 |
+
"What are the payment options?",
|
57 |
+
"Tell me about the course benefits",
|
58 |
+
"How can I enroll?",
|
59 |
],
|
60 |
+
title="🤖Chucho Bot - CopyXpert Sales Assistant",
|
61 |
+
description="Hi! I'm Chucho Bot, your personal assistant for the CopyXpert course. How can I help you today?"
|
62 |
)
|
63 |
|
64 |
demo.launch()
|