Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import random
|
| 3 |
+
import pandas as pd
|
| 4 |
+
import matplotlib.pyplot as plt
|
| 5 |
+
|
| 6 |
+
# ---- UI Layout ----
|
| 7 |
+
st.set_page_config(page_title="StreetStyle Trends Dashboard", layout="wide")
|
| 8 |
+
st.title("👕 StreetStyle Trends - Business Analytics & Insights Hub")
|
| 9 |
+
|
| 10 |
+
# Sidebar for navigation
|
| 11 |
+
st.sidebar.header("Navigation")
|
| 12 |
+
page = st.sidebar.radio("Go to", ["Business Overview", "Dashboard Features", "Competitor Analysis", "Chatbot"])
|
| 13 |
+
|
| 14 |
+
# Business Overview Section
|
| 15 |
+
if page == "Business Overview":
|
| 16 |
+
st.header("🏢 Business Overview")
|
| 17 |
+
st.markdown("""
|
| 18 |
+
**Business Name:** StreetStyle Trends
|
| 19 |
+
**Industry:** Fashion & Apparel
|
| 20 |
+
**Specialty:** Affordable, trendy streetwear for young adults
|
| 21 |
+
**Mission:** To provide stylish, budget-friendly streetwear that resonates with the youth culture.
|
| 22 |
+
""")
|
| 23 |
+
|
| 24 |
+
st.subheader("Key Highlights")
|
| 25 |
+
st.markdown("""
|
| 26 |
+
- 🚀 Rapidly growing brand with a strong social media presence.
|
| 27 |
+
- 💡 Focused on fast-fashion trends and affordability.
|
| 28 |
+
- 📈 High customer engagement and repeat purchase rates.
|
| 29 |
+
""")
|
| 30 |
+
|
| 31 |
+
# Dashboard Features Section
|
| 32 |
+
elif page == "Dashboard Features":
|
| 33 |
+
st.header("📊 Dashboard Features for StreetStyle Trends")
|
| 34 |
+
st.markdown("""
|
| 35 |
+
Here are the key features of the StreetStyle Trends analytics dashboard:
|
| 36 |
+
""")
|
| 37 |
+
|
| 38 |
+
col1, col2 = st.columns(2)
|
| 39 |
+
|
| 40 |
+
with col1:
|
| 41 |
+
st.success("✅ **Trending Products Section**")
|
| 42 |
+
st.write("Shows what’s popular based on recent sales data.")
|
| 43 |
+
st.success("✅ **Social Media Buzz Tracker**")
|
| 44 |
+
st.write("Fetches keywords and trends from Instagram and Twitter to keep you updated on what’s hot.")
|
| 45 |
+
|
| 46 |
+
with col2:
|
| 47 |
+
st.success("✅ **Stock & Inventory Updates**")
|
| 48 |
+
st.write("Notifies you when popular items are low on stock to avoid missed sales opportunities.")
|
| 49 |
+
st.success("✅ **Customer Engagement Metrics**")
|
| 50 |
+
st.write("Tracks reviews, feedback, and repeat customer statistics to measure brand loyalty.")
|
| 51 |
+
|
| 52 |
+
# Competitor Analysis Section
|
| 53 |
+
elif page == "Competitor Analysis":
|
| 54 |
+
st.header("🔍 Competitor Analysis")
|
| 55 |
+
st.markdown("""
|
| 56 |
+
Here’s a breakdown of StreetStyle Trends' key competitors in the fashion and apparel industry:
|
| 57 |
+
""")
|
| 58 |
+
|
| 59 |
+
competitors = {
|
| 60 |
+
"Competitor": ["H&M", "Zara", "Uniqlo", "Forever 21"],
|
| 61 |
+
"Specialty": [
|
| 62 |
+
"Affordable, stylish clothing",
|
| 63 |
+
"Fast-fashion brand with trend-driven apparel",
|
| 64 |
+
"Minimalist, high-quality casual wear",
|
| 65 |
+
"Budget-friendly fashion for youth"
|
| 66 |
+
],
|
| 67 |
+
"Market Position": ["Global", "Global", "Global", "Global"]
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
df_competitors = pd.DataFrame(competitors)
|
| 71 |
+
st.dataframe(df_competitors, hide_index=True)
|
| 72 |
+
|
| 73 |
+
st.subheader("Competitor Insights")
|
| 74 |
+
st.markdown("""
|
| 75 |
+
- **H&M:** Known for affordability and wide variety, but lacks exclusivity.
|
| 76 |
+
- **Zara:** Excels in fast-fashion but often at a higher price point.
|
| 77 |
+
- **Uniqlo:** Focuses on quality and minimalism, but less trendy.
|
| 78 |
+
- **Forever 21:** Targets youth with budget-friendly options, but struggles with brand perception.
|
| 79 |
+
""")
|
| 80 |
+
|
| 81 |
+
# Chatbot Section
|
| 82 |
+
elif page == "Chatbot":
|
| 83 |
+
st.header("🤖 AI-Powered Business Insights Chatbot")
|
| 84 |
+
|
| 85 |
+
chat_history = st.session_state.get("chat_history", [])
|
| 86 |
+
|
| 87 |
+
user_input = st.text_input("💬 Ask a question about StreetStyle Trends, competitors, or the fashion industry:")
|
| 88 |
+
|
| 89 |
+
if st.button("Ask AI"):
|
| 90 |
+
responses = [
|
| 91 |
+
"StreetStyle Trends is well-positioned to capture the youth market with its affordable pricing and trendy designs.",
|
| 92 |
+
"Consider leveraging social media influencers to boost brand visibility among young adults.",
|
| 93 |
+
"H&M and Zara are strong competitors, but StreetStyle Trends can differentiate itself through exclusive designs.",
|
| 94 |
+
"Focus on sustainability to appeal to eco-conscious consumers in the fashion industry."
|
| 95 |
+
]
|
| 96 |
+
bot_response = random.choice(responses)
|
| 97 |
+
|
| 98 |
+
chat_history.append(f"🧑 You: {user_input}")
|
| 99 |
+
chat_history.append(f"🤖 AI: {bot_response}")
|
| 100 |
+
st.session_state["chat_history"] = chat_history
|
| 101 |
+
|
| 102 |
+
for chat in chat_history[-5:]: # Show last 5 messages
|
| 103 |
+
st.write(chat)
|
| 104 |
+
|
| 105 |
+
if st.button("Clear Chat"):
|
| 106 |
+
st.session_state["chat_history"] = []
|
| 107 |
+
|
| 108 |
+
# Sample Data Analytics Section (Placeholder)
|
| 109 |
+
if page == "Business Overview" or page == "Dashboard Features":
|
| 110 |
+
st.sidebar.write("---")
|
| 111 |
+
st.sidebar.header("Sample Analytics")
|
| 112 |
+
if st.sidebar.button("Generate Sample Data"):
|
| 113 |
+
data = {
|
| 114 |
+
"Category": ["Tops", "Bottoms", "Accessories", "Footwear", "Outerwear"],
|
| 115 |
+
"Revenue (in thousands)": [random.randint(50, 200) for _ in range(5)],
|
| 116 |
+
"Growth (%)": [random.randint(5, 25) for _ in range(5)]
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
df = pd.DataFrame(data)
|
| 120 |
+
|
| 121 |
+
st.subheader("📈 Revenue by Product Category")
|
| 122 |
+
fig, ax = plt.subplots()
|
| 123 |
+
ax.bar(df["Category"], df["Revenue (in thousands)"], color=["blue", "green", "orange", "red", "purple"])
|
| 124 |
+
st.pyplot(fig)
|
| 125 |
+
|
| 126 |
+
st.subheader("🧠 AI Insights")
|
| 127 |
+
fake_insight = random.choice([
|
| 128 |
+
"Tops are the best-selling category this quarter!",
|
| 129 |
+
"Footwear sales are expected to grow by 20% next month.",
|
| 130 |
+
"Accessories have seen a 15% increase in customer engagement."
|
| 131 |
+
])
|
| 132 |
+
st.success(fake_insight)
|
| 133 |
+
|
| 134 |
+
st.sidebar.write("🚀 Built with ❤️ using Streamlit")
|