Spaces:
Sleeping
Sleeping
Testing
Browse files1123434567891011121314151617181920212223242526272867293031323334353637383940414243444546474849505191052531213from transformers import pipelineimport gradio as gr
# Load the fine-tuned model from Hugging Facegenerator = pipeline("text2text-generation", model="DetectiveShadow/inspiration-message-generator")def readiness_predictor( savings, income, bills, entertainment, sales_skills, dependents, assets, age): # Simple heuristic formula for "entrepreneurial readiness" disposable_income = income - bills - entertainment score = ( (savings + assets) / 1000 + disposable_income / 500 + sales_skills * 2 - dependents + (40 - abs(35 - age)) / 5 ) score = max(0, min(100, score)) # clamp between 0 and 100 if score < 30: prediction = "Low readiness" elif score < 60: prediction = "Moderate readiness" else: prediction = "High readiness" return { "Readiness Score": round(score, 2), "Prediction": prediction }
# Define test promptprompt = "Age: 32 | Profession: Engineer | Archetype: Innovator"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 )
# Run modelresult = generator(prompt, max_new_tokens=100)[0]["generated_text"]demo.launch()
# Print outputprint(result)app.py+49-9