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