Spaces:
Sleeping
Sleeping
Create brainstorm_manager.py
Browse files- brainstorm_manager.py +76 -0
brainstorm_manager.py
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from typing import Dict, List
|
| 3 |
+
from datetime import datetime
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
class BrainstormManager:
|
| 7 |
+
def __init__(self):
|
| 8 |
+
if 'products' not in st.session_state:
|
| 9 |
+
st.session_state.products = {}
|
| 10 |
+
|
| 11 |
+
def generate_product_form(self) -> tuple:
|
| 12 |
+
with st.form("product_form"):
|
| 13 |
+
basic_info = {
|
| 14 |
+
"name": st.text_input("Product Name"),
|
| 15 |
+
"category": st.selectbox("Category", ["Digital", "Physical", "Service"]),
|
| 16 |
+
"description": st.text_area("Description"),
|
| 17 |
+
"target_audience": st.multiselect("Target Audience",
|
| 18 |
+
["Students", "Professionals", "Businesses", "Seniors", "Youth"]),
|
| 19 |
+
"price_range": st.slider("Price Range ($)", 0, 1000, (50, 200)),
|
| 20 |
+
"launch_date": st.date_input("Expected Launch Date")
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
st.subheader("Market Analysis")
|
| 24 |
+
market_analysis = {
|
| 25 |
+
"competitors": st.text_area("Main Competitors (one per line)"),
|
| 26 |
+
"unique_features": st.text_area("Unique Selling Points"),
|
| 27 |
+
"market_size": st.selectbox("Market Size",
|
| 28 |
+
["Small", "Medium", "Large", "Enterprise"]),
|
| 29 |
+
"growth_potential": st.slider("Growth Potential", 1, 10)
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
submitted = st.form_submit_button("Save Product")
|
| 33 |
+
return basic_info, market_analysis, submitted
|
| 34 |
+
|
| 35 |
+
def analyze_product(self, product_data: Dict) -> Dict:
|
| 36 |
+
insights = {
|
| 37 |
+
"market_opportunity": self._calculate_opportunity_score(product_data),
|
| 38 |
+
"suggested_price": self._suggest_price(product_data),
|
| 39 |
+
"risk_factors": self._identify_risks(product_data),
|
| 40 |
+
"next_steps": self._generate_next_steps(product_data)
|
| 41 |
+
}
|
| 42 |
+
return insights
|
| 43 |
+
|
| 44 |
+
def _calculate_opportunity_score(self, data: Dict) -> int:
|
| 45 |
+
score = 0
|
| 46 |
+
if data.get("market_size") == "Large":
|
| 47 |
+
score += 3
|
| 48 |
+
if len(data.get("target_audience", [])) >= 2:
|
| 49 |
+
score += 2
|
| 50 |
+
if data.get("growth_potential", 0) > 7:
|
| 51 |
+
score += 2
|
| 52 |
+
return min(score, 10)
|
| 53 |
+
|
| 54 |
+
def _suggest_price(self, data: Dict) -> float:
|
| 55 |
+
base_price = sum(data.get("price_range", (0, 0))) / 2
|
| 56 |
+
if data.get("market_size") == "Enterprise":
|
| 57 |
+
base_price *= 1.5
|
| 58 |
+
return round(base_price, 2)
|
| 59 |
+
|
| 60 |
+
def _identify_risks(self, data: Dict) -> List[str]:
|
| 61 |
+
risks = []
|
| 62 |
+
if data.get("competitors"):
|
| 63 |
+
risks.append("Competitive market - differentiation crucial")
|
| 64 |
+
if len(data.get("target_audience", [])) < 2:
|
| 65 |
+
risks.append("Narrow target audience - consider expansion")
|
| 66 |
+
return risks
|
| 67 |
+
|
| 68 |
+
def _generate_next_steps(self, data: Dict) -> List[str]:
|
| 69 |
+
steps = [
|
| 70 |
+
"Create detailed product specification",
|
| 71 |
+
"Develop MVP timeline",
|
| 72 |
+
"Plan marketing strategy"
|
| 73 |
+
]
|
| 74 |
+
if data.get("market_size") == "Enterprise":
|
| 75 |
+
steps.append("Prepare enterprise sales strategy")
|
| 76 |
+
return steps
|