DetectiveShadow commited on
Commit
6e9b35b
·
verified ·
1 Parent(s): b8d04ee
Files changed (1) hide show
  1. app.py +52 -0
app.py ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ def readiness_predictor(
4
+ savings, income, bills, entertainment, sales_skills, dependents, assets, age
5
+ ):
6
+ # Simple heuristic formula for "entrepreneurial readiness"
7
+ disposable_income = income - bills - entertainment
8
+ score = (
9
+ (savings + assets) / 1000
10
+ + disposable_income / 500
11
+ + sales_skills * 2
12
+ - dependents
13
+ + (40 - abs(35 - age)) / 5
14
+ )
15
+ score = max(0, min(100, score)) # clamp between 0 and 100
16
+
17
+ if score < 30:
18
+ prediction = "Low readiness"
19
+ elif score < 60:
20
+ prediction = "Moderate readiness"
21
+ else:
22
+ prediction = "High readiness"
23
+
24
+ return {
25
+ "Readiness Score": round(score, 2),
26
+ "Prediction": prediction
27
+ }
28
+
29
+ with gr.Blocks() as demo:
30
+ gr.Markdown("# Entrepreneurial Readiness Predictor")
31
+
32
+ with gr.Row():
33
+ with gr.Column():
34
+ savings = gr.Number(label="Savings Amount ($)", value=1000)
35
+ income = gr.Number(label="Monthly Income ($)", value=4000)
36
+ bills = gr.Number(label="Monthly Bills ($)", value=2500)
37
+ entertainment = gr.Number(label="Monthly Entertainment ($)", value=300)
38
+ sales_skills = gr.Slider(label="Sales Skills (1–5)", minimum=1, maximum=5, step=1, value=3)
39
+ dependents = gr.Slider(label="Dependents (0–6)", minimum=0, maximum=6, step=1, value=1)
40
+ assets = gr.Number(label="Assets ($)", value=8000)
41
+ age = gr.Number(label="Age", value=28)
42
+
43
+ with gr.Column():
44
+ output = gr.JSON(label="Prediction")
45
+ btn = gr.Button("Predict")
46
+ btn.click(
47
+ readiness_predictor,
48
+ inputs=[savings, income, bills, entertainment, sales_skills, dependents, assets, age],
49
+ outputs=output
50
+ )
51
+
52
+ demo.launch()