Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| def predict_trend(social_mentions, customer_feedback, market_conditions, econ_indicator, purchase_history, product_demand): | |
| # Simple formula combining the inputs | |
| feedback_score = {"Positive": 1, "Neutral": 0, "Negative": -1} | |
| market_score = {"Bullish": 1, "Stable": 0, "Bearish": -1} | |
| score = ( | |
| 0.2 * social_mentions + | |
| 0.2 * feedback_score[customer_feedback] + | |
| 0.2 * market_score[market_conditions] + | |
| 0.1 * econ_indicator + | |
| 0.15 * purchase_history + | |
| 0.15 * product_demand | |
| ) | |
| if score > 60: | |
| result = "High Trend Potential π" | |
| elif score > 30: | |
| result = "Moderate Trend Potential π" | |
| else: | |
| result = "Low Trend Potential β οΈ" | |
| return f"Trend Score: {round(score, 2)}\nPrediction: {result}" | |
| demo = gr.Interface( | |
| fn=predict_trend, | |
| inputs=[ | |
| gr.Slider(0, 100, label="Social Media Mentions"), | |
| gr.Radio(["Positive", "Neutral", "Negative"], label="Customer Feedback"), | |
| gr.Radio(["Bullish", "Stable", "Bearish"], label="Market Conditions"), | |
| gr.Slider(0, 100, label="Economic Indicator Strength"), | |
| gr.Slider(0, 100, label="Purchase History Strength"), | |
| gr.Slider(0, 100, label="Product Demand Level"), | |
| ], | |
| outputs="text", | |
| title="FIN - Future Insights", | |
| description="Predict market trend potential based on key business inputs." | |
| ) | |
| demo.launch() | |