File size: 1,450 Bytes
843eb7b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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()