File size: 2,832 Bytes
010b4fa
8de97df
010b4fa
c87a3cf
010b4fa
bb1bdda
010b4fa
 
c87a3cf
 
 
 
 
 
010b4fa
bb1bdda
 
010b4fa
c87a3cf
010b4fa
c87a3cf
010b4fa
c87a3cf
010b4fa
c87a3cf
ebadd3a
c87a3cf
 
 
 
 
 
 
010b4fa
 
c87a3cf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
010b4fa
c87a3cf
 
 
 
 
 
ebadd3a
010b4fa
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import gradio as gr

def readiness_predictor(
    savings, income, bills, entertainment, sales_skills, dependents, assets, age, idea_level
):
    # Simple heuristic formula
    disposable_income = income - bills - entertainment
    score = (
        (savings + assets) / 1000
        + disposable_income / 500
        + sales_skills * 2
        + idea_level * 3            # <-- new factor: strong weight for business idea quality
        - dependents
        + (40 - abs(35 - age)) / 5
    )
    score = max(0, min(100, score))

    if score < 30:
        prediction = "๐Ÿ”ด Low readiness"
    elif score < 60:
        prediction = "๐ŸŸก Moderate readiness"
    else:
        prediction = "๐ŸŸข High readiness"
    
    return score, prediction

with gr.Blocks(theme=gr.themes.Soft()) as demo:
    gr.Markdown(
        """
        # ๐Ÿš€ Entrepreneurial Readiness Predictor  
        Enter your details below to estimate your readiness to start a business.  
        """
    )
    
    with gr.Row():
        with gr.Column(scale=1):
            savings = gr.Number(label="๐Ÿ’ฐ Savings Amount ($)", value=1000)
            income = gr.Number(label="๐Ÿ’ต Monthly Income ($)", value=4000)
            bills = gr.Number(label="๐Ÿ“‘ Monthly Bills ($)", value=2500)
            entertainment = gr.Number(label="๐ŸŽ‰ Monthly Entertainment ($)", value=300)
            sales_skills = gr.Slider(label="๐Ÿ—ฃ๏ธ Sales Skills (1โ€“5)", minimum=1, maximum=5, step=1, value=3)
            dependents = gr.Slider(label="๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘ง Dependents (0โ€“6)", minimum=0, maximum=6, step=1, value=1)
            assets = gr.Number(label="๐Ÿ  Assets ($)", value=8000)
            age = gr.Number(label="๐ŸŽ‚ Age", value=28)
            idea_level = gr.Slider(label="๐Ÿ’ก Business Idea Quality (1โ€“10)", minimum=1, maximum=10, step=1, value=5)
            btn = gr.Button("๐Ÿ”ฎ Predict Readiness")
        
        with gr.Column(scale=1):
            score_bar = gr.Slider(label="Readiness Score", minimum=0, maximum=100, value=0, interactive=False)
            prediction_text = gr.Label(label="Result")
            info = gr.Markdown(
                "โ„น๏ธ **What does this mean?**\n\n"
                "The readiness score (0โ€“100) is based on savings, income, "
                "expenses, skills, dependents, age, and your business idea quality. "
                "Higher values suggest stronger preparedness for entrepreneurship.\n\n"
                "- **0โ€“29:** Low readiness ๐Ÿ”ด\n"
                "- **30โ€“59:** Moderate readiness ๐ŸŸก\n"
                "- **60โ€“100:** High readiness ๐ŸŸข"
            )
    
    btn.click(
        readiness_predictor,
        inputs=[savings, income, bills, entertainment, sales_skills, dependents, assets, age, idea_level],
        outputs=[score_bar, prediction_text]
    )

demo.launch()