Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| from typing import Dict, List | |
| from datetime import datetime | |
| class BrainstormManager: | |
| def __init__(self): | |
| if 'products' not in st.session_state: | |
| st.session_state.products = {} | |
| def generate_product_form(self) -> tuple: | |
| with st.form("product_form"): | |
| basic_info = { | |
| "name": st.text_input("Product Name"), | |
| "category": st.selectbox("Category", ["Digital", "Physical", "Service"]), | |
| "description": st.text_area("Description"), | |
| "target_audience": st.multiselect("Target Audience", | |
| ["Students", "Professionals", "Businesses", "Seniors", "Youth"]), | |
| "price_range": st.slider("Price Range ($)", 0, 1000, (50, 200)), | |
| "launch_date": st.date_input("Expected Launch Date") | |
| } | |
| st.subheader("Market Analysis") | |
| market_analysis = { | |
| "competitors": st.text_area("Main Competitors (one per line)"), | |
| "unique_features": st.text_area("Unique Selling Points"), | |
| "market_size": st.selectbox("Market Size", | |
| ["Small", "Medium", "Large", "Enterprise"]), | |
| "growth_potential": st.slider("Growth Potential", 1, 10) | |
| } | |
| submitted = st.form_submit_button("Save Product") | |
| return basic_info, market_analysis, submitted | |
| def analyze_product(self, product_data: Dict) -> Dict: | |
| insights = { | |
| "market_opportunity": self._calculate_opportunity_score(product_data), | |
| "suggested_price": self._suggest_price(product_data), | |
| "risk_factors": self._identify_risks(product_data), | |
| "next_steps": self._generate_next_steps(product_data) | |
| } | |
| return insights | |
| def _calculate_opportunity_score(self, data: Dict) -> int: | |
| score = 0 | |
| if data.get("market_size") == "Large": | |
| score += 3 | |
| if len(data.get("target_audience", [])) >= 2: | |
| score += 2 | |
| if data.get("growth_potential", 0) > 7: | |
| score += 2 | |
| return min(score, 10) | |
| def _suggest_price(self, data: Dict) -> float: | |
| base_price = sum(data.get("price_range", (0, 0))) / 2 | |
| if data.get("market_size") == "Enterprise": | |
| base_price *= 1.5 | |
| return round(base_price, 2) | |
| def _identify_risks(self, data: Dict) -> List[str]: | |
| risks = [] | |
| if data.get("competitors"): | |
| risks.append("Competitive market - differentiation crucial") | |
| if len(data.get("target_audience", [])) < 2: | |
| risks.append("Narrow target audience - consider expansion") | |
| return risks | |
| def _generate_next_steps(self, data: Dict) -> List[str]: | |
| steps = [ | |
| "Create detailed product specification", | |
| "Develop MVP timeline", | |
| "Plan marketing strategy" | |
| ] | |
| if data.get("market_size") == "Enterprise": | |
| steps.append("Prepare enterprise sales strategy") | |
| return steps |