Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from model import score_opportunity
|
3 |
+
|
4 |
+
def predict_deal(amount, stage, industry, lead_score, email_count, meeting_count, close_date_gap):
|
5 |
+
input_data = {
|
6 |
+
"amount": amount,
|
7 |
+
"stage": stage,
|
8 |
+
"industry": industry,
|
9 |
+
"lead_score": lead_score,
|
10 |
+
"email_count": email_count,
|
11 |
+
"meeting_count": meeting_count,
|
12 |
+
"close_date_gap": close_date_gap
|
13 |
+
}
|
14 |
+
result = score_opportunity(input_data)
|
15 |
+
return result['score'], result['risk'], result['recommendation']
|
16 |
+
|
17 |
+
with gr.Blocks(title="AI Deal Qualification Engine") as demo:
|
18 |
+
gr.Markdown("# 🤖 AI-Powered B2B Deal Qualification Engine")
|
19 |
+
|
20 |
+
with gr.Row():
|
21 |
+
amount = gr.Number(label="Amount")
|
22 |
+
stage = gr.Dropdown(["Prospecting", "Qualified", "Proposal", "Negotiation", "Closed Won", "Closed Lost"], label="Stage")
|
23 |
+
industry = gr.Textbox(label="Industry")
|
24 |
+
lead_score = gr.Number(label="Lead Score")
|
25 |
+
email_count = gr.Number(label="Email Count")
|
26 |
+
meeting_count = gr.Number(label="Meeting Count")
|
27 |
+
close_date_gap = gr.Number(label="Close Date Gap (days)")
|
28 |
+
|
29 |
+
submit_btn = gr.Button("Predict Deal Quality")
|
30 |
+
|
31 |
+
with gr.Row():
|
32 |
+
score = gr.Number(label="Score (0–100)", interactive=False)
|
33 |
+
risk = gr.Textbox(label="Risk Level", interactive=False)
|
34 |
+
recommendation = gr.Textbox(label="AI Recommendation", lines=2, interactive=False)
|
35 |
+
|
36 |
+
submit_btn.click(fn=predict_deal,
|
37 |
+
inputs=[amount, stage, industry, lead_score, email_count, meeting_count, close_date_gap],
|
38 |
+
outputs=[score, risk, recommendation])
|
39 |
+
|
40 |
+
demo.launch()
|