Update model.py
Browse files
model.py
CHANGED
@@ -1,23 +1,33 @@
|
|
1 |
import random
|
2 |
-
from utilities import prepare_text_input, generate_recommendation
|
3 |
|
4 |
-
|
5 |
-
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
def predict(data, model, tokenizer, summarizer):
|
9 |
-
|
|
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
"
|
17 |
-
"High"
|
18 |
-
)
|
19 |
|
20 |
-
recommendation = generate_recommendation(
|
|
|
|
|
|
|
|
|
21 |
|
22 |
return {
|
23 |
"score": score,
|
|
|
1 |
import random
|
|
|
2 |
|
3 |
+
def generate_recommendation(stage, emails, meetings):
|
4 |
+
if stage == "Negotiation":
|
5 |
+
return "Follow up with final pricing discussion."
|
6 |
+
elif stage == "Proposal/Price Quote":
|
7 |
+
return "Schedule one more meeting to present value."
|
8 |
+
elif meetings == 0:
|
9 |
+
return "Schedule a meeting to initiate engagement."
|
10 |
+
elif emails < 2:
|
11 |
+
return "Send follow-up email to re-engage."
|
12 |
+
else:
|
13 |
+
return "Continue monitoring engagement signals."
|
14 |
|
15 |
def predict(data, model, tokenizer, summarizer):
|
16 |
+
score = random.randint(50, 95)
|
17 |
+
confidence = round(random.uniform(0.65, 0.95), 2)
|
18 |
|
19 |
+
if score >= 75:
|
20 |
+
risk = "Low"
|
21 |
+
elif score >= 55:
|
22 |
+
risk = "Medium"
|
23 |
+
else:
|
24 |
+
risk = "High"
|
|
|
|
|
25 |
|
26 |
+
recommendation = generate_recommendation(
|
27 |
+
data["stage"],
|
28 |
+
data["emails_last_7_days"],
|
29 |
+
data["meetings_last_30_days"]
|
30 |
+
)
|
31 |
|
32 |
return {
|
33 |
"score": score,
|