Spaces:
Sleeping
Sleeping
Update app.py
Browse filesChange the layout
5 unmodified lines67891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545 unmodified lines# Simple heuristic formuladisposable_income = income - bills - entertainmentscore = ((savings + assets) / 1000 # more savings/assets = better+ disposable_income / 500 # more free income = better+ sales_skills * 2 # sales skills matter a lot- dependents # more dependents = more pressure+ (40 - abs(35 - age)) / 5 # ideal range ~35 years old)# Clamp score to 0โ100score = max(0, min(100, score))if score < 30:prediction = "Low readiness"elif score < 60:prediction = "Moderate readiness"else:prediction = "High readiness"return {"Readiness Score": round(score, 2),"Prediction": prediction}with gr.Blocks() as demo:gr.Markdown("# ๐ Entrepreneurial Readiness Predictor")with gr.Row():with gr.Column():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)with gr.Column():output = gr.JSON(label="Prediction")btn = gr.Button("Predict")btn.click(readiness_predictor,inputs=[savings, income, bills, entertainment, sales_skills, dependents, assets, age],outputs=output)demo.launch()5 unmodified lines67891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465665 unmodified lines# Simple heuristic formuladisposable_income = income - bills - entertainmentscore = ((savings + assets) / 1000+ disposable_income / 500+ sales_skills * 2- 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, predictionwith gr.Blocks(theme=gr.themes.Soft()) as demo:gr.Markdown("""# ๐ Entrepreneurial Readiness PredictorEnter 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)btn = gr.Button("๐ฎ Predict Readiness")with gr.Column(scale=1):score_bar = gr.Progress(label="Readiness Score", value=0, maximum=100)prediction_text = gr.Label(label="Result")info = gr.Markdown("โน๏ธ **What does this mean?**\n\n""The readiness score (0โ100) is a simple index based on savings, income, ""expenses, skills, dependents, and age. Higher values suggest stronger ""financial and personal 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],outputs=[score_bar, prediction_text])demo.launch()
app.py+45-33