Update app.py
Browse files
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
|
| 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 |
-
|
| 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
|
| 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
|
| 48 |
|
| 49 |
with gr.Row():
|
| 50 |
-
score = gr.Number(label="๐งฎ
|
| 51 |
confidence = gr.Number(label="๐ Confidence (0โ1)", interactive=False)
|
| 52 |
risk = gr.Textbox(label="๐ฆ Risk Level", interactive=False)
|
| 53 |
-
recommendation = gr.Textbox(label="๐ง
|
| 54 |
|
| 55 |
-
submit_btn.click(
|
| 56 |
-
|
| 57 |
-
|
|
|
|
|
|
|
| 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()
|