Sanjayraju30 commited on
Commit
51983a1
ยท
verified ยท
1 Parent(s): 0f80c4e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -18
app.py CHANGED
@@ -1,3 +1,5 @@
 
 
1
  import gradio as gr
2
  from model import score_opportunity
3
  from utils import validate_data
@@ -13,21 +15,15 @@ def predict_deal(amount, stage, industry, lead_score, emails_last_7_days, meetin
13
  }
14
 
15
  if not validate_data(input_data):
16
- return 0, 0.0, "Invalid", "โš ๏ธ Please enter valid numeric values and select a stage."
17
 
18
  result = score_opportunity(input_data)
19
  return result['score'], result['confidence'], result['risk'], result['recommendation']
20
 
21
  with gr.Blocks(title="AI Deal Qualification Engine") as demo:
22
  gr.Markdown("""
23
- # ๐Ÿค– AI-Powered Deal Qualification Engine
24
- _Estimate the quality of your B2B opportunity using AI._
25
-
26
- Enter opportunity details below to predict:
27
- โœ… Deal Score
28
- โœ… Risk Level
29
- โœ… Confidence
30
- โœ… AI Recommendation
31
  """)
32
 
33
  with gr.Row():
@@ -37,23 +33,25 @@ with gr.Blocks(title="AI Deal Qualification Engine") as demo:
37
  ["Prospecting", "Qualified", "Proposal", "Proposal/Price Quote", "Negotiation", "Closed Won", "Closed Lost"],
38
  label="๐Ÿ“Š Deal Stage"
39
  )
40
- industry = gr.Textbox(label="๐Ÿญ Industry (e.g., Software, Healthcare)")
41
 
42
  with gr.Column():
43
  lead_score = gr.Number(label="๐Ÿ“ˆ Lead Score (0โ€“100)")
44
- emails_last_7_days = gr.Number(label="โœ‰๏ธ Emails Last 7 Days")
45
- meetings_last_30_days = gr.Number(label="๐Ÿ“… Meetings Last 30 Days")
46
 
47
- submit_btn = gr.Button("๐Ÿ” Predict Deal")
48
 
49
  with gr.Row():
50
- score = gr.Number(label="๐Ÿงฎ Deal Score (0โ€“100)", interactive=False)
51
  confidence = gr.Number(label="๐Ÿ“Š Confidence (0โ€“1)", interactive=False)
52
  risk = gr.Textbox(label="๐Ÿšฆ Risk Level", interactive=False)
53
- recommendation = gr.Textbox(label="๐Ÿง  AI Recommendation", lines=2, interactive=False)
54
 
55
- submit_btn.click(fn=predict_deal,
56
- inputs=[amount, stage, industry, lead_score, emails_last_7_days, meetings_last_30_days],
57
- outputs=[score, confidence, risk, recommendation])
 
 
58
 
59
  demo.launch()
 
1
+ # app.py
2
+
3
  import gradio as gr
4
  from model import score_opportunity
5
  from utils import validate_data
 
15
  }
16
 
17
  if not validate_data(input_data):
18
+ return 0, 0.0, "Invalid", "โš ๏ธ Please enter all fields correctly."
19
 
20
  result = score_opportunity(input_data)
21
  return result['score'], result['confidence'], result['risk'], result['recommendation']
22
 
23
  with gr.Blocks(title="AI Deal Qualification Engine") as demo:
24
  gr.Markdown("""
25
+ # ๐Ÿค– AI-Powered Deal Qualification Engine
26
+ _Predict B2B deal success using AI-based scoring._
 
 
 
 
 
 
27
  """)
28
 
29
  with gr.Row():
 
33
  ["Prospecting", "Qualified", "Proposal", "Proposal/Price Quote", "Negotiation", "Closed Won", "Closed Lost"],
34
  label="๐Ÿ“Š Deal Stage"
35
  )
36
+ industry = gr.Textbox(label="๐Ÿญ Industry")
37
 
38
  with gr.Column():
39
  lead_score = gr.Number(label="๐Ÿ“ˆ Lead Score (0โ€“100)")
40
+ emails_last_7_days = gr.Number(label="โœ‰๏ธ Emails in Last 7 Days")
41
+ meetings_last_30_days = gr.Number(label="๐Ÿ“… Meetings in Last 30 Days")
42
 
43
+ submit_btn = gr.Button("๐Ÿ” Predict")
44
 
45
  with gr.Row():
46
+ score = gr.Number(label="๐Ÿงฎ Score (0โ€“100)", interactive=False)
47
  confidence = gr.Number(label="๐Ÿ“Š Confidence (0โ€“1)", interactive=False)
48
  risk = gr.Textbox(label="๐Ÿšฆ Risk Level", interactive=False)
49
+ recommendation = gr.Textbox(label="๐Ÿง  Recommendation", lines=2, interactive=False)
50
 
51
+ submit_btn.click(
52
+ fn=predict_deal,
53
+ inputs=[amount, stage, industry, lead_score, emails_last_7_days, meetings_last_30_days],
54
+ outputs=[score, confidence, risk, recommendation]
55
+ )
56
 
57
  demo.launch()