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()