Iammcqwory commited on
Commit
5ecce7d
Β·
verified Β·
1 Parent(s): 633371a

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +78 -0
app.py ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import numpy as np
4
+ import plotly.express as px
5
+
6
+ # Sample Data for Testing
7
+ competitor_prices = pd.DataFrame({
8
+ "Competitor": ["Shop A", "Shop B", "Shop C", "Shop D"],
9
+ "Product": ["Sneakers", "Hoodies", "Watches", "Backpacks"],
10
+ "Price (Ksh)": [4500, 3200, 7500, 2800],
11
+ "Discount (%)": [10, 5, 15, 0]
12
+ })
13
+
14
+ sales_data = pd.DataFrame({
15
+ "Date": pd.date_range(start="2024-01-01", periods=30, freq="D"),
16
+ "Sales (Ksh)": np.random.randint(5000, 50000, size=30)
17
+ })
18
+
19
+ # ---- Streamlit App ----
20
+ st.set_page_config(page_title="AI Business Dashboard", layout="wide")
21
+
22
+ # ---- Sidebar Navigation ----
23
+ st.sidebar.title("πŸ“Š AI Business Intelligence")
24
+ page = st.sidebar.radio("Navigate", ["Dashboard", "Competitor Analysis", "Marketing Insights", "AI Suggestions"])
25
+
26
+ # ---- Dashboard ----
27
+ if page == "Dashboard":
28
+ st.title("πŸ“ˆ Business Performance Dashboard")
29
+
30
+ tab1, tab2 = st.tabs(["Sales Trends", "Product Insights"])
31
+
32
+ with tab1:
33
+ st.subheader("πŸ“Š Daily Sales Performance")
34
+ fig = px.line(sales_data, x="Date", y="Sales (Ksh)", title="Sales Over Time")
35
+ st.plotly_chart(fig, use_container_width=True)
36
+
37
+ with tab2:
38
+ st.subheader("πŸ“¦ Top-Selling Products")
39
+ top_products = pd.DataFrame({
40
+ "Product": ["Sneakers", "Hoodies", "Watches", "Backpacks"],
41
+ "Sales (Ksh)": [25000, 18000, 15000, 12000]
42
+ })
43
+ fig2 = px.bar(top_products, x="Product", y="Sales (Ksh)", title="Best-Selling Products", text="Sales (Ksh)")
44
+ st.plotly_chart(fig2, use_container_width=True)
45
+
46
+ # ---- Competitor Analysis ----
47
+ elif page == "Competitor Analysis":
48
+ st.title("πŸ“‰ Competitor Price Tracking")
49
+ st.table(competitor_prices)
50
+
51
+ # Price Adjustment Recommendation
52
+ st.subheader("πŸ’‘ AI Pricing Suggestion")
53
+ st.info("Your Sneakers are priced at Ksh 5000. AI suggests a **10% discount (Ksh 4500)** to remain competitive.")
54
+
55
+ # ---- Marketing Insights ----
56
+ elif page == "Marketing Insights":
57
+ st.title("πŸ“£ Social Media Performance")
58
+ tab1, tab2 = st.tabs(["Instagram Engagement", "Ad Optimization"])
59
+
60
+ with tab1:
61
+ st.subheader("πŸ”₯ Best Posting Times")
62
+ best_times = pd.DataFrame({"Time": ["10 AM", "1 PM", "6 PM", "9 PM"], "Engagement": [300, 450, 700, 550]})
63
+ fig3 = px.bar(best_times, x="Time", y="Engagement", title="Best Times to Post on Instagram")
64
+ st.plotly_chart(fig3, use_container_width=True)
65
+
66
+ with tab2:
67
+ st.subheader("πŸ“’ Ad Performance Insights")
68
+ st.write("πŸ’‘ AI suggests allocating **60% of the budget** to Instagram Stories instead of Feed Ads for better ROI.")
69
+
70
+ # ---- AI Suggestions ----
71
+ elif page == "AI Suggestions":
72
+ st.title("πŸ€– AI-Powered Business Recommendations")
73
+ st.info("πŸ“ˆ AI predicts that **Hoodies will trend next month**. Consider increasing stock and running a promo.")
74
+ st.info("πŸ’° AI suggests increasing ad spend on **Instagram Reels for better conversions**.")
75
+
76
+ # ---- Footer ----
77
+ st.sidebar.markdown("---")
78
+ st.sidebar.caption("πŸš€ Powered by Waziri Collective Labs | 2025")