Spaces:
Running
Running
import gradio as gr | |
from fpdf import FPDF | |
import os | |
import tempfile | |
import re | |
import shutil | |
from datetime import datetime | |
# ===== New imports for PPT generation ===== | |
from pptx import Presentation | |
from pptx.util import Inches, Pt | |
from pptx.enum.text import MSO_ANCHOR, PP_ALIGN | |
# ===== Import sentence-transformers for semantic similarity ===== | |
from sentence_transformers import SentenceTransformer, util | |
# Load the semantic model once | |
model = SentenceTransformer("all-MiniLM-L6-v2") | |
# Define semantic categories with descriptions | |
categories = { | |
"Food & Beverage": "Restaurants, cafes, food stalls, cloud kitchens, tiffin services, bakeries, catering.", | |
"E-commerce": "Online stores, delivery apps, product marketplaces, digital selling platforms.", | |
"Hospitality": "Hotels, homestays, guest houses, hostels, resorts, travel services.", | |
"Pet Care": "Pet grooming, veterinary care, mobile vet vans, dog walking, animal boarding.", | |
"Health & Fitness": "Gyms, yoga classes, personal training, physiotherapy, wellness programs.", | |
"Education & Training": "Tutoring, courses, online schools, skill training, test preparation.", | |
"Retail Automation": "Vending machines, smart kiosks, automated retail stores.", | |
"Green & Sustainability": "Eco-friendly products, recycling, waste management, solar energy.", | |
"Local Services": "Cleaning, handyman, repair, salon, on-demand home services.", | |
"Technology / Software": "Apps, SaaS platforms, AI tools, fintech, blockchain services." | |
} | |
# Precompute embeddings for categories | |
category_embeddings = { | |
cat: model.encode(desc, convert_to_tensor=True) | |
for cat, desc in categories.items() | |
} | |
def semantic_category(idea): | |
idea_emb = model.encode(idea, convert_to_tensor=True) | |
scores = {cat: util.cos_sim(idea_emb, emb).item() for cat, emb in category_embeddings.items()} | |
best_cat = max(scores, key=scores.get) | |
confidence = round(scores[best_cat], 3) | |
return best_cat, confidence | |
# -------------------- Text utilities -------------------- | |
def normalize_for_pdf(text: str) -> str: | |
text = (text.replace("—", "-") | |
.replace("–", "-") | |
.replace("•", "-") | |
.replace("✓", "") | |
.replace("✔", "") | |
.replace("✅", "") | |
.replace("❌", "")) | |
try: | |
text.encode("latin-1") | |
return text | |
except UnicodeEncodeError: | |
return text.encode("latin-1", "ignore").decode("latin-1") | |
def has(text: str, *words): | |
return any(w in text for w in words) | |
def extract_price_points(text: str): | |
prices = re.findall(r"(₹\s*\d+[kKmM]?|Rs\.?\s*\d+[kKmM]?|\b\d{2,5}\b)", text) | |
return ", ".join(prices[:5]) if prices else None | |
# -------------------- Budget analysis generator -------------------- | |
def generate_budget_analysis(domain: str, idea: str): | |
"""Generate detailed budget analysis based on domain and idea""" | |
main_domain = domain.split(" (")[0].strip() | |
idea_lower = idea.lower() | |
budget_data = { | |
"Food & Beverage": { | |
"startup_costs": { | |
"Kitchen Setup/Equipment": "₹50,000 - ₹2,00,000", | |
"Initial Inventory": "₹15,000 - ₹30,000", | |
"Licenses (FSSAI, Local)": "₹5,000 - ₹15,000", | |
"Branding & Packaging": "₹10,000 - ₹25,000", | |
"Security Deposit": "₹20,000 - ₹50,000" | |
}, | |
"monthly_costs": { | |
"Rent": "₹10,000 - ₹40,000", | |
"Raw Materials": "₹20,000 - ₹60,000", | |
"Staff Salary": "₹15,000 - ₹45,000", | |
"Utilities": "₹3,000 - ₹8,000", | |
"Marketing": "₹5,000 - ₹15,000" | |
}, | |
"revenue_projection": "₹1,00,000 - ₹3,00,000/month", | |
"break_even": "4-8 months", | |
"total_investment": "₹1,00,000 - ₹3,60,000" | |
}, | |
"E-commerce": { | |
"startup_costs": { | |
"Website/Platform Setup": "₹25,000 - ₹75,000", | |
"Initial Inventory": "₹50,000 - ₹2,00,000", | |
"Photography & Content": "₹10,000 - ₹20,000", | |
"Legal & Registration": "₹10,000 - ₹25,000", | |
"Packaging Materials": "₹5,000 - ₹15,000" | |
}, | |
"monthly_costs": { | |
"Platform Fees": "₹5,000 - ₹20,000", | |
"Inventory Replenishment": "₹40,000 - ₹1,50,000", | |
"Digital Marketing": "₹15,000 - ₹50,000", | |
"Fulfillment & Shipping": "₹10,000 - ₹30,000", | |
"Virtual Assistant": "₹8,000 - ₹15,000" | |
}, | |
"revenue_projection": "₹1,50,000 - ₹5,00,000/month", | |
"break_even": "6-12 months", | |
"total_investment": "₹1,00,000 - ₹3,35,000" | |
}, | |
"Hospitality": { | |
"startup_costs": { | |
"Property Setup": "₹1,00,000 - ₹5,00,000", | |
"Furniture & Furnishing": "₹75,000 - ₹2,00,000", | |
"Licenses & Registration": "₹15,000 - ₹35,000", | |
"Initial Marketing": "₹20,000 - ₹50,000", | |
"Security Deposit": "₹50,000 - ₹1,50,000" | |
}, | |
"monthly_costs": { | |
"Rent/EMI": "₹25,000 - ₹80,000", | |
"Housekeeping": "₹10,000 - ₹25,000", | |
"Utilities": "₹5,000 - ₹15,000", | |
"Platform Commission": "₹8,000 - ₹20,000", | |
"Maintenance": "₹5,000 - ₹12,000" | |
}, | |
"revenue_projection": "₹80,000 - ₹2,50,000/month", | |
"break_even": "8-15 months", | |
"total_investment": "₹2,60,000 - ₹9,35,000" | |
}, | |
"Pet Care": { | |
"startup_costs": { | |
"Equipment & Tools": "₹30,000 - ₹60,000", | |
"Vehicle Setup": "₹50,000 - ₹1,50,000", | |
"Training & Certification": "₹15,000 - ₹30,000", | |
"Insurance": "₹10,000 - ₹20,000", | |
"Initial Marketing": "₹8,000 - ₹15,000" | |
}, | |
"monthly_costs": { | |
"Fuel & Maintenance": "₹8,000 - ₹15,000", | |
"Supplies Replenishment": "₹5,000 - ₹12,000", | |
"Marketing": "₹5,000 - ₹10,000", | |
"Insurance Premium": "₹2,000 - ₹4,000", | |
"Helper Salary": "₹8,000 - ₹15,000" | |
}, | |
"revenue_projection": "₹60,000 - ₹1,50,000/month", | |
"break_even": "4-8 months", | |
"total_investment": "₹1,13,000 - ₹2,75,000" | |
}, | |
"Technology / Software": { | |
"startup_costs": { | |
"Development Costs": "₹1,00,000 - ₹5,00,000", | |
"Cloud Infrastructure": "₹10,000 - ₹25,000", | |
"Legal & IP Protection": "₹20,000 - ₹50,000", | |
"Design & UX": "₹25,000 - ₹75,000", | |
"Testing & QA": "₹15,000 - ₹40,000" | |
}, | |
"monthly_costs": { | |
"Server & Cloud Costs": "₹8,000 - ₹25,000", | |
"Development Team": "₹50,000 - ₹2,00,000", | |
"Marketing & Acquisition": "₹25,000 - ₹1,00,000", | |
"Support & Maintenance": "₹10,000 - ₹30,000", | |
"Third-party Services": "₹5,000 - ₹15,000" | |
}, | |
"revenue_projection": "₹1,00,000 - ₹10,00,000/month", | |
"break_even": "8-18 months", | |
"total_investment": "₹1,70,000 - ₹6,90,000" | |
} | |
} | |
# Default budget for other domains | |
default_budget = { | |
"startup_costs": { | |
"Equipment & Setup": "₹30,000 - ₹80,000", | |
"Initial Inventory/Supplies": "₹20,000 - ₹50,000", | |
"Legal & Registration": "₹8,000 - ₹20,000", | |
"Marketing Materials": "₹10,000 - ₹25,000", | |
"Working Capital": "₹25,000 - ₹50,000" | |
}, | |
"monthly_costs": { | |
"Operational Expenses": "₹15,000 - ₹35,000", | |
"Staff/Helper Costs": "₹10,000 - ₹25,000", | |
"Marketing": "₹8,000 - ₹20,000", | |
"Utilities & Misc": "₹5,000 - ₹12,000" | |
}, | |
"revenue_projection": "₹80,000 - ₹2,00,000/month", | |
"break_even": "6-12 months", | |
"total_investment": "₹93,000 - ₹2,25,000" | |
} | |
budget_info = budget_data.get(main_domain, default_budget) | |
# Adjust budget based on specific keywords in idea | |
if "mobile" in idea_lower or "van" in idea_lower: | |
budget_info = dict(budget_info) # Create a copy | |
if "startup_costs" in budget_info: | |
budget_info["startup_costs"]["Vehicle/Mobile Setup"] = "₹50,000 - ₹2,00,000" | |
return budget_info | |
# -------------------- Dynamic suggestions generator -------------------- | |
def generate_suggestions(domain, demand, audience, competitors, revenue, innovation, idea): | |
"""Generate dynamic suggestions based on the specific domain and idea characteristics""" | |
suggestions = [] | |
main_domain = domain.split(" (")[0].strip() | |
idea_lower = idea.lower() | |
# Base validation suggestion - always relevant | |
suggestions.append("1. Validate Early: Start with a 'concierge MVP' - manually deliver your service to 10 customers before building any technology or infrastructure.") | |
# Domain-specific suggestions | |
if main_domain == "Food & Beverage": | |
if "temple" in idea_lower or "devotional" in idea_lower: | |
suggestions.append("2. Festival Calendar Strategy: Plan inventory and staffing around religious festivals. Stock special prasad items and extended hours during peak devotional seasons.") | |
elif "tech park" in idea_lower or "office" in idea_lower: | |
suggestions.append("2. Corporate Partnerships: Negotiate with office complexes for exclusive food court rights or bulk lunch orders. Offer subscription meals for employees.") | |
else: | |
suggestions.append("2. Local Sourcing Edge: Partner directly with local farmers/suppliers to reduce costs by 15-20% while promoting 'farm-to-table' freshness.") | |
suggestions.append("3. Quick Service Focus: Optimize for under 5-minute service time during peak hours. Pre-prepare popular items and use mobile ordering to reduce wait times.") | |
if "delivery" in idea_lower: | |
suggestions.append("4. Hyperlocal Delivery: Limit delivery radius to 3km for faster delivery and lower costs. Use WhatsApp ordering to avoid app development initially.") | |
elif main_domain == "E-commerce": | |
if "temple" in idea_lower or "pooja" in idea_lower: | |
suggestions.append("2. Festival-Focused Inventory: Stock up 2 months before major festivals. Create festival-specific bundles and offer bulk discounts for family orders.") | |
suggestions.append("3. Local Sourcing Advantage: Partner with local artisans and temple suppliers to offer authentic, region-specific religious items not available on Amazon/Flipkart.") | |
else: | |
suggestions.append("2. Niche Market Domination: Focus on a specific product category where you can become the #1 local supplier rather than competing broadly.") | |
suggestions.append("3. Customer Service Differentiation: Offer same-day delivery, easy returns, and personal consultation calls - services big platforms can't match at local level.") | |
elif main_domain == "Hospitality": | |
if "pilgrim" in idea_lower or "temple" in idea_lower: | |
suggestions.append("2. Package Deals: Create all-inclusive packages including accommodation, local guide, and temple visit arrangements. Partner with taxi services.") | |
suggestions.append("3. Seasonal Pricing: Implement dynamic pricing for festival seasons and offer early bird discounts for off-season bookings.") | |
else: | |
suggestions.append("2. Experience Curation: Don't just offer accommodation - curate local experiences, food tours, or cultural activities that hotels can't provide.") | |
suggestions.append("3. Long-stay Incentives: Offer weekly/monthly rates for business travelers or students. This provides steady cash flow and reduces booking overhead.") | |
elif main_domain == "Pet Care": | |
suggestions.append("2. Mobile Service Advantage: Offer at-home services when competitors require drop-offs. Create subscription packages for regular grooming/care.") | |
suggestions.append("3. Trust Building: Provide real-time photo updates during service, background-verified staff, and emergency contact system for pet parents.") | |
suggestions.append("4. Community Building: Create a local pet parent WhatsApp group for tips, emergency help, and word-of-mouth marketing.") | |
elif main_domain == "Technology / Software": | |
suggestions.append("2. No-Code MVP: Use tools like Bubble, Airtable, or Zapier to create your first version without hiring developers. Validate before investing in custom development.") | |
suggestions.append("3. Local-First Strategy: Focus on solving hyper-local problems before expanding. Partner with local businesses as pilot customers.") | |
suggestions.append("4. Freemium Model: Offer basic features free to build user base, then monetize with premium features or higher usage limits.") | |
elif main_domain == "Health & Fitness": | |
suggestions.append("2. Home Service Premium: Charge 2-3x more for at-home training compared to gym rates, but provide personalized attention and convenience.") | |
suggestions.append("3. Corporate Wellness: Target companies for employee wellness programs. One corporate contract can replace 10+ individual clients.") | |
suggestions.append("4. Results Documentation: Use before/after photos and progress tracking to build credibility and attract new clients through social proof.") | |
# Location-specific suggestions | |
if "mobile" in idea_lower or "van" in idea_lower: | |
suggestions.append(f"{len(suggestions)+1}. Route Optimization: Plan daily routes to maximize stops while minimizing fuel costs. Use apps like Route4Me or Google My Maps for efficient planning.") | |
# Competition-based suggestions | |
if "unorganized" in competitors.lower() or "local" in competitors.lower(): | |
suggestions.append(f"{len(suggestions)+1}. Digital Advantage: Even basic digital presence (WhatsApp Business, Google My Business) can give you significant edge over traditional competitors.") | |
# Revenue model suggestions | |
if "subscription" in revenue.lower(): | |
suggestions.append(f"{len(suggestions)+1}. Subscription Psychology: Offer annual plans with 2-month discount. Monthly subscribers often churn, but annual payments improve cash flow and retention.") | |
# Final strategic suggestion based on demand level | |
if "High" in demand: | |
suggestions.append(f"{len(suggestions)+1}. Scale Preparation: High demand means focus on operational efficiency from day 1. Document all processes to enable quick team expansion.") | |
elif "Moderate" in demand: | |
suggestions.append(f"{len(suggestions)+1}. Community Building: Moderate demand requires strong word-of-mouth. Focus on exceptional service to your first 50 customers to create advocates.") | |
else: | |
suggestions.append(f"{len(suggestions)+1}. Pivot Readiness: Test multiple variations of your service offering quickly. Low initial demand may require repositioning your value proposition.") | |
# Ensure we don't exceed reasonable length | |
return suggestions[:6] | |
# -------------------- Idea analysis -------------------- | |
def classify_and_analyze(idea: str): | |
t = idea.lower() | |
near_temples = has(t, "temple", "mandir", "pilgrim", "pooja", "devotional") | |
near_it_parks = has(t, "it park", "tech park", "office", "corporate", "campus", "hitec", "hitech") | |
metro_transit = has(t, "metro", "railway", "bus station", "airport", "transit", "station") | |
local_delivery = has(t, "deliver", "delivery", "on-demand", "doorstep", "hyperlocal", "last mile") | |
is_food = has(t, "tiffin", "meal", "restaurant", "cafe", "coffee", "tea", "cloud kitchen", "snacks", "veg", "vegetarian") | |
is_vending = has(t, "vending machine", "vending", "kiosk") | |
is_ecom = has(t, "online store", "ecommerce", "marketplace", "shop") | |
is_hospitality = has(t, "homestay", "stay", "hostel", "guest house", "lodge") | |
is_souvenir = has(t, "souvenir", "prasad", "gift", "religious items", "pooja items") | |
is_services = has(t, "services", "local services", "handyman", "utility", "cleaning", "repair") | |
# Keyword-based domain classification | |
if is_food and near_it_parks: | |
domain = "Food & Beverage (workforce-focused)" | |
elif is_food and near_temples: | |
domain = "Food & Beverage (religious tourism)" | |
elif is_food: | |
domain = "Food & Beverage" | |
elif is_vending and metro_transit: | |
domain = "Retail Automation (vending at transit)" | |
elif is_vending: | |
domain = "Retail Automation (vending)" | |
elif is_hospitality and near_temples: | |
domain = "Hospitality (religious tourism)" | |
elif is_hospitality: | |
domain = "Hospitality" | |
elif is_ecom and near_temples: | |
domain = "E-commerce (devotional goods / hyperlocal)" | |
elif is_ecom: | |
domain = "E-commerce" | |
elif is_souvenir and near_temples: | |
domain = "Retail (souvenirs for pilgrims)" | |
elif is_services or local_delivery: | |
domain = "Local Services / Hyperlocal Delivery" | |
else: | |
domain = "General Local Commerce / Services" | |
semantic_conf = 0 | |
if domain == "General Local Commerce / Services": | |
sem_domain, conf = semantic_category(idea) | |
semantic_conf = conf | |
domain = f"{sem_domain} (semantic match {conf})" | |
# Demand | |
if is_food and (near_it_parks or metro_transit): | |
demand = "High - strong weekday footfall; peaks at commute and lunch times." | |
elif is_food and near_temples: | |
demand = "Moderate to High - weekends/festivals spike; morning and evening peaks." | |
elif is_vending and metro_transit: | |
demand = "Moderate - permit dependent; strong impulse buys with right placement." | |
elif is_hospitality and near_temples: | |
demand = "High in season and festivals, moderate otherwise." | |
elif is_ecom and near_temples: | |
demand = "Moderate - niche but loyal; festival boosts." | |
else: | |
demand = "Moderate - validate via small test." | |
# Audience | |
if near_it_parks: | |
audience = "Office workers, contractors, security staff, delivery riders." | |
elif near_temples: | |
audience = "Pilgrims, families, local devotees, tour groups." | |
elif metro_transit: | |
audience = "Daily commuters, students, travelers." | |
else: | |
audience = "Local residents within 2-5 km radius; nearby early adopters." | |
# Competitors | |
if is_food: | |
competitors = "Cloud kitchens, canteens, tea/coffee stalls, Swiggy/Zomato vendors." | |
elif is_vending: | |
competitors = "Kiosks, convenience stores; few automated options." | |
elif is_hospitality: | |
competitors = "Budget hotels, homestays, lodges." | |
elif is_ecom: | |
competitors = "Local kirana/pooja shops, Amazon/Flipkart resellers." | |
else: | |
competitors = "Unorganized local players; compete on convenience and trust." | |
# Revenue | |
price_hint = extract_price_points(t) | |
if is_food: | |
revenue = "Per-item, combos; subscriptions; corporate tie-ups." | |
elif is_vending: | |
revenue = "Per-transaction; convenience premium; ads on machines." | |
elif is_hospitality: | |
revenue = "Nightly rates; surge pricing in festivals." | |
elif is_ecom or local_delivery: | |
revenue = "Product margin + delivery fee; festive bundles." | |
else: | |
revenue = "Service fees, bundles, memberships." | |
if price_hint: | |
revenue += f" Detected price hints: {price_hint}." | |
# Features | |
features = [] | |
if is_food: | |
features += ["Simple menu", "Under 5 min service", "Clean packaging", "Digital payments"] | |
if is_vending: | |
features += ["Cashless", "24/7 access", "Live stock display", "Quick purchase"] | |
if is_ecom or local_delivery: | |
features += ["3-step ordering", "Same-day delivery", "Clear pricing", "Order tracking"] | |
if is_hospitality: | |
features += ["Clean rooms", "Local guide", "Flexible check-in", "Easy booking"] | |
if near_temples: | |
features += ["Festival-ready packs", "Location-aware directions"] | |
if near_it_parks: | |
features += ["Office timings", "Bulk orders"] | |
if not features: | |
features = ["Simple onboarding", "Fast support", "Mobile-friendly experience"] | |
# Innovation | |
if is_vending: | |
innovation = "Smart inventory, remote monitoring." | |
elif is_food and near_it_parks: | |
innovation = "Pre-order pickups, corporate subscriptions." | |
elif is_food and near_temples: | |
innovation = "Queue tokens, hygienic prasad packs." | |
elif is_hospitality: | |
innovation = "Curated itineraries, verified guides." | |
elif is_ecom: | |
innovation = "Local sourcing, festival logistics." | |
else: | |
innovation = "Digitize discovery, bookings, feedback." | |
# ===== Improved SCORING ===== | |
base_score_map = { | |
"Food & Beverage": 7.5, | |
"E-commerce": 7.2, | |
"Hospitality": 6.8, | |
"Pet Care": 7.0, | |
"Health & Fitness": 7.4, | |
"Education & Training": 7.6, | |
"Retail Automation": 7.1, | |
"Green & Sustainability": 7.8, | |
"Local Services": 6.9, | |
"Technology / Software": 8.0 | |
} | |
if semantic_conf > 0: | |
base_cat = domain.split(" (semantic")[0] | |
score = base_score_map.get(base_cat, 7.0) + (semantic_conf - 0.5) * 3 | |
else: | |
score = 7.0 | |
if is_food: score += 0.5 | |
if near_it_parks: score += 0.3 | |
if near_temples: score += 0.2 | |
if is_vending: score -= 0.3 | |
if is_hospitality: score -= 0.1 | |
score = round(max(1.0, min(10.0, score)), 1) | |
analysis_lines = [ | |
f"Domain: {domain}", | |
f"Market Demand: {demand}", | |
f"Target Audience: {audience}", | |
f"Competitor Analysis: {competitors}", | |
f"Revenue Model: {revenue}", | |
f"Innovation Potential: {innovation}", | |
f"Build Possibility Score: {score}/10" | |
] | |
# Call the updated function to generate dynamic suggestions | |
suggestions = generate_suggestions(domain, demand, audience, competitors, revenue, innovation, idea) | |
return analysis_lines, features[:6], "; ".join(features[:6]), suggestions, domain | |
# -------------------- Domain-specific implementation plans -------------------- | |
def implementation_plan(idea: str, domain: str): | |
"""Generate domain-specific implementation plans""" | |
# Extract main domain category | |
main_domain = domain.split(" (")[0].strip() | |
if main_domain == "Food & Beverage": | |
return [ | |
"Week 1-2: Menu Planning & Licensing - Define 3-5 signature items, get FSSAI license, identify suppliers.", | |
"Week 3: Location Scouting - Secure kitchen space/stall, negotiate rent, ensure water/electricity access.", | |
"Week 4: Setup Basic Operations - Install cooking equipment, create simple POS system, design basic packaging.", | |
"Week 5: Soft Launch - Start with friends/family, gather feedback, refine recipes and service time.", | |
"Week 6-7: Marketing Push - Create social media presence, distribute flyers, partner with local offices/groups.", | |
"Week 8-9: Scale Operations - Implement online ordering (WhatsApp/simple app), add delivery if viable.", | |
"Month 3: Optimize & Expand - Track popular items, reduce waste, consider catering services or second location.", | |
"Month 4-6: Build Loyalty - Introduce membership discounts, bulk order deals, seasonal menu updates.", | |
"Month 6+: Growth Strategy - Explore franchising, corporate tie-ups, or expanding to related food categories." | |
] | |
elif main_domain == "E-commerce": | |
return [ | |
"Week 1: Market Research - Validate product demand, analyze competitors, define unique value proposition.", | |
"Week 2: Product Sourcing - Identify reliable suppliers, negotiate terms, order initial inventory (start small).", | |
"Week 3-4: Platform Setup - Create website/use existing marketplace (Amazon, Flipkart), setup payment gateway.", | |
"Week 5: Photography & Listings - Professional product photos, compelling descriptions, competitive pricing.", | |
"Week 6-7: Soft Launch - List products, test ordering process, fulfill first orders manually to ensure quality.", | |
"Week 8-10: Marketing & SEO - Social media campaigns, Google Ads, influencer partnerships, optimize for search.", | |
"Month 3: Automation & Scaling - Implement inventory management, consider fulfillment services, expand product range.", | |
"Month 4-6: Customer Retention - Email marketing, loyalty programs, customer service optimization, reviews management.", | |
"Month 6+: Advanced Growth - Data analytics, international expansion, private labeling, or marketplace partnerships." | |
] | |
elif main_domain == "Hospitality": | |
return [ | |
"Week 1-2: Property & Legal - Secure property lease, get tourism/hospitality licenses, fire safety clearance.", | |
"Week 3-4: Setup & Furnishing - Basic furniture, clean bedding, bathroom essentials, Wi-Fi setup.", | |
"Week 5: Booking Platform - List on Airbnb/Booking.com, create simple website, setup online payment.", | |
"Week 6: Service Standards - Define check-in/out process, cleaning protocols, local area guides.", | |
"Week 7-8: Soft Launch - Host friends/family, gather feedback, refine processes, take quality photos.", | |
"Week 9-10: Marketing Push - Social media presence, local tourism partnerships, guest review optimization.", | |
"Month 3: Operational Excellence - Streamline housekeeping, 24/7 support system, guest experience improvements.", | |
"Month 4-6: Expand Services - Local tour packages, airport transfers, meal services, seasonal promotions.", | |
"Month 6+: Scale or Premium - Additional properties, premium services, corporate bookings, or unique experiences." | |
] | |
elif main_domain == "Pet Care": | |
return [ | |
"Week 1-2: Skills & Certification - Get pet care certification, first aid training, insurance coverage.", | |
"Week 3: Equipment & Supplies - Purchase grooming tools, transportation setup, create service kits.", | |
"Week 4: Service Menu - Define services (grooming, walking, sitting), create pricing structure.", | |
"Week 5-6: Legal & Marketing - Business registration, create flyers, social media profiles, local vet partnerships.", | |
"Week 7-8: Pilot Testing - Offer services to friends/family pets, gather testimonials, refine processes.", | |
"Week 9-12: Customer Acquisition - Door-to-door marketing, online presence, pet community engagement.", | |
"Month 3: Service Excellence - Develop standard operating procedures, emergency protocols, client communication system.", | |
"Month 4-6: Business Growth - Hire additional staff, expand service area, introduce premium services.", | |
"Month 6+: Scale Operations - Multiple service teams, pet product sales, training programs, or franchise model." | |
] | |
elif main_domain == "Health & Fitness": | |
return [ | |
"Week 1-2: Certification & Planning - Get fitness certifications, define target audience, create program curriculum.", | |
"Week 3: Space & Equipment - Secure training space/gym partnership, buy basic equipment, ensure safety measures.", | |
"Week 4: Program Development - Design workout plans, nutrition guides, progress tracking systems.", | |
"Week 5-6: Marketing Materials - Create promotional content, before/after testimonials, pricing packages.", | |
"Week 7-8: Soft Launch - Train friends/family for free, gather feedback, refine programs.", | |
"Week 9-12: Client Acquisition - Social media marketing, local partnerships, referral programs, free trial sessions.", | |
"Month 3: Service Optimization - Track client progress, improve retention rates, add group classes.", | |
"Month 4-6: Expand Offerings - Online coaching, nutrition consultation, corporate wellness programs.", | |
"Month 6+: Scale Business - Hire trainers, multiple locations, fitness app development, or online course creation." | |
] | |
elif main_domain == "Education & Training": | |
return [ | |
"Week 1-2: Curriculum Design - Define learning objectives, create course materials, assessment methods.", | |
"Week 3: Platform Setup - Choose teaching platform (Zoom, classroom), create learning management system.", | |
"Week 4: Marketing Materials - Course brochures, demo videos, testimonials, pricing structure.", | |
"Week 5-6: Pilot Program - Run free/discounted sessions, gather feedback, refine teaching methods.", | |
"Week 7-8: Student Acquisition - Social media marketing, educational partnerships, word-of-mouth referrals.", | |
"Week 9-12: Course Delivery - Maintain quality, track student progress, provide personalized support.", | |
"Month 3: Program Enhancement - Add advanced modules, practical projects, certification programs.", | |
"Month 4-6: Scale Offerings - Multiple course levels, corporate training, online self-paced options.", | |
"Month 6+: Business Expansion - Hire instructors, franchise model, educational technology development." | |
] | |
elif main_domain == "Retail Automation": | |
return [ | |
"Week 1-3: Market Research - Identify high-traffic locations, study foot patterns, negotiate placement permits.", | |
"Week 4-6: Machine Procurement - Source vending machines, customize for products, install payment systems.", | |
"Week 7: Location Setup - Install machines, ensure power/connectivity, create attractive signage.", | |
"Week 8-10: Product Testing - Stock popular items, monitor sales patterns, adjust inventory mix.", | |
"Week 11-12: Operations Optimization - Establish restocking schedule, remote monitoring system, maintenance protocols.", | |
"Month 3: Performance Analysis - Track sales data, customer preferences, optimize product placement.", | |
"Month 4-6: Expand Network - Add more machines in successful locations, explore new product categories.", | |
"Month 6+: Advanced Features - Implement AI-based inventory, digital advertising, cashless payment upgrades." | |
] | |
elif main_domain == "Green & Sustainability": | |
return [ | |
"Week 1-2: Impact Assessment - Define environmental problem, research sustainable solutions, identify target market.", | |
"Week 3-4: Product/Service Development - Source eco-friendly materials, design sustainable processes, get certifications.", | |
"Week 5: Pilot Testing - Create prototypes/test services, gather user feedback, measure environmental impact.", | |
"Week 6-8: Brand Building - Create compelling sustainability story, educational content, community partnerships.", | |
"Week 9-12: Market Launch - Target environmentally conscious consumers, premium pricing for quality.", | |
"Month 3: Community Engagement - Partner with environmental organizations, schools, corporate CSR programs.", | |
"Month 4-6: Scale Impact - Expand product range, improve processes, measure and report environmental benefits.", | |
"Month 6+: Systematic Change - Influence supply chains, policy advocacy, create industry standards." | |
] | |
elif main_domain == "Local Services": | |
return [ | |
"Week 1-2: Service Definition - List specific services, create service packages, define service area.", | |
"Week 3: Equipment & Supplies - Purchase necessary tools, create mobile service kit, get vehicle if needed.", | |
"Week 4: Pricing & Scheduling - Create transparent pricing, booking system, availability calendar.", | |
"Week 5-6: Local Marketing - Door-to-door flyers, local Facebook groups, partner with real estate agents.", | |
"Week 7-8: Service Delivery - Focus on quality, punctuality, customer satisfaction, gather reviews.", | |
"Week 9-12: Customer Base Building - Referral programs, repeat customer discounts, seasonal service packages.", | |
"Month 3: Operational Excellence - Streamline processes, invest in better tools, hire additional help if needed.", | |
"Month 4-6: Service Expansion - Add complementary services, emergency services, maintenance packages.", | |
"Month 6+: Business Growth - Multiple service teams, commercial clients, franchise opportunities." | |
] | |
elif main_domain == "Technology / Software": | |
return [ | |
"Week 1-3: Product Planning - Define user problems, create feature list, design user experience wireframes.", | |
"Week 4-8: MVP Development - Build minimum viable product, focus on core functionality, ensure basic security.", | |
"Week 9-10: Beta Testing - Release to limited users, gather feedback, fix critical bugs.", | |
"Week 11-12: Launch Preparation - App store optimization, landing page, user onboarding flow.", | |
"Month 3: User Acquisition - Digital marketing, product hunt launch, influencer outreach, content marketing.", | |
"Month 4-6: Product Iteration - Analyze user behavior, add features based on feedback, improve retention.", | |
"Month 6+: Scale & Monetize - Implement revenue model, scale infrastructure, explore partnerships or funding." | |
] | |
else: # Default/General plan | |
return [ | |
"Week 1-2: Define your offer - 3-5 best-sellers and clear pricing.", | |
"Week 3: Run a 1-week pilot with a basic landing page or local test.", | |
"Week 4: Setup MVP - branding, UPI/QR payments, simple inventory in a spreadsheet.", | |
"Week 5-6: Choose 1-2 locations and secure local permissions.", | |
"Week 7-8: Optimize operations for 5-minute service time.", | |
"Week 9-10: Bundle pricing during peak hours or festivals.", | |
"Week 11-12: Promote using signage, WhatsApp lists, and Google Maps.", | |
"Month 3: Track key metrics (orders/day, repeat rate) and iterate weekly.", | |
"Month 6+: Scale to second location once you hit 30% repeat customers for 3 weeks." | |
] | |
# -------------------- Enhanced PDF generator with budget analysis -------------------- | |
def generate_pdf(idea, analysis_lines, features, impl_steps, suggestions, domain): | |
pdf = FPDF() | |
pdf.set_auto_page_break(auto=True, margin=15) | |
pdf.add_page() | |
# Title | |
pdf.set_font("Arial", "B", 16) | |
pdf.cell(0, 10, txt=normalize_for_pdf("Startup Idea Analysis Report"), ln=True, align="C") | |
pdf.set_font("Arial", "", 12) | |
pdf.ln(4) | |
pdf.multi_cell(0, 8, txt=normalize_for_pdf(f"Idea: {idea}")) | |
pdf.ln(2) | |
# Date | |
pdf.set_font("Arial", "I", 10) | |
pdf.cell(0, 6, txt=normalize_for_pdf(f"Generated on: {datetime.now().strftime('%B %d, %Y')}"), ln=True, align="R") | |
pdf.ln(4) | |
# Analysis Section | |
pdf.set_font("Arial", "B", 14) | |
pdf.cell(0, 8, txt=normalize_for_pdf("Business Analysis"), ln=True) | |
pdf.set_font("Arial", "", 11) | |
for idx, line in enumerate(analysis_lines, start=1): | |
pdf.multi_cell(0, 6, txt=normalize_for_pdf(f"{idx}. {line}")) | |
pdf.ln(1) | |
# Budget Analysis Section | |
pdf.ln(3) | |
pdf.set_font("Arial", "B", 14) | |
pdf.cell(0, 8, txt=normalize_for_pdf("Budget Analysis"), ln=True) | |
budget_info = generate_budget_analysis(domain, idea) | |
# Startup Costs | |
pdf.set_font("Arial", "B", 12) | |
pdf.cell(0, 7, txt=normalize_for_pdf("Initial Investment Required:"), ln=True) | |
pdf.set_font("Arial", "", 11) | |
for item, cost in budget_info["startup_costs"].items(): | |
pdf.multi_cell(0, 5, txt=normalize_for_pdf(f"• {item}: {cost}")) | |
# Monthly Costs | |
pdf.ln(2) | |
pdf.set_font("Arial", "B", 12) | |
pdf.cell(0, 7, txt=normalize_for_pdf("Monthly Operating Costs:"), ln=True) | |
pdf.set_font("Arial", "", 11) | |
for item, cost in budget_info["monthly_costs"].items(): | |
pdf.multi_cell(0, 5, txt=normalize_for_pdf(f"• {item}: {cost}")) | |
# Financial Projections | |
pdf.ln(2) | |
pdf.set_font("Arial", "B", 12) | |
pdf.cell(0, 7, txt=normalize_for_pdf("Financial Projections:"), ln=True) | |
pdf.set_font("Arial", "", 11) | |
pdf.multi_cell(0, 5, txt=normalize_for_pdf(f"• Expected Revenue: {budget_info['revenue_projection']}")) | |
pdf.multi_cell(0, 5, txt=normalize_for_pdf(f"• Break-even Timeline: {budget_info['break_even']}")) | |
pdf.multi_cell(0, 5, txt=normalize_for_pdf(f"• Total Investment Range: {budget_info['total_investment']}")) | |
# Key Features | |
pdf.ln(4) | |
pdf.set_font("Arial", "B", 14) | |
pdf.cell(0, 8, txt=normalize_for_pdf("Essential Features"), ln=True) | |
pdf.set_font("Arial", "", 11) | |
for f in features: | |
pdf.multi_cell(0, 6, txt=normalize_for_pdf(f"• {f}")) | |
# Implementation Plan | |
pdf.ln(3) | |
pdf.set_font("Arial", "B", 14) | |
pdf.cell(0, 8, txt=normalize_for_pdf("Detailed Implementation Roadmap"), ln=True) | |
pdf.set_font("Arial", "", 11) | |
for i, step in enumerate(impl_steps, start=1): | |
pdf.multi_cell(0, 6, txt=normalize_for_pdf(f"{i}. {step}")) | |
pdf.ln(1) | |
# Strategic Suggestions | |
pdf.ln(3) | |
pdf.set_font("Arial", "B", 14) | |
pdf.cell(0, 8, txt=normalize_for_pdf("Strategic Recommendations"), ln=True) | |
pdf.set_font("Arial", "", 11) | |
for s in suggestions: | |
pdf.multi_cell(0, 6, txt=normalize_for_pdf(s)) | |
pdf.ln(1) | |
# Risk Assessment | |
pdf.ln(3) | |
pdf.set_font("Arial", "B", 14) | |
pdf.cell(0, 8, txt=normalize_for_pdf("Key Risk Factors & Mitigation"), ln=True) | |
pdf.set_font("Arial", "", 11) | |
# Generate domain-specific risks | |
main_domain = domain.split(" (")[0].strip() | |
risks = { | |
"Food & Beverage": [ | |
"• Health regulations compliance - Obtain all required licenses before operations", | |
"• Food safety and quality control - Implement strict hygiene protocols", | |
"• Seasonal demand fluctuations - Diversify menu and target multiple customer segments" | |
], | |
"E-commerce": [ | |
"• High customer acquisition costs - Focus on organic growth and referrals initially", | |
"• Inventory management challenges - Start with limited SKUs and pre-orders", | |
"• Platform dependency risks - Build direct customer relationships through email/WhatsApp" | |
], | |
"Technology / Software": [ | |
"• Technical development delays - Use no-code solutions initially, hire experienced developers", | |
"• User adoption challenges - Focus on solving a real pain point with simple UX", | |
"• Competition from established players - Target niche market segments first" | |
] | |
} | |
default_risks = [ | |
"• Market validation failure - Start with small pilot before full investment", | |
"• Cash flow management - Maintain 3-6 months operating expenses as buffer", | |
"• Competition response - Focus on unique value proposition and customer service excellence" | |
] | |
domain_risks = risks.get(main_domain, default_risks) | |
for risk in domain_risks: | |
pdf.multi_cell(0, 6, txt=normalize_for_pdf(risk)) | |
# Save PDF | |
fd, path = tempfile.mkstemp(suffix=".pdf") | |
os.close(fd) | |
pdf.output(path) | |
output_path = os.path.join(tempfile.gettempdir(), f"Startup_Analysis_{datetime.now().strftime('%Y%m%d_%H%M%S')}.pdf") | |
shutil.copy(path, output_path) | |
return output_path | |
# -------------------- Enhanced PPT generator -------------------- | |
def generate_ppt(idea, analysis_lines, features, impl_steps, suggestions, domain): | |
try: | |
prs = Presentation() | |
# --- Slide 1: Title Slide --- | |
title_slide_layout = prs.slide_layouts[0] | |
slide = prs.slides.add_slide(title_slide_layout) | |
title = slide.shapes.title | |
subtitle = slide.placeholders[1] | |
title.text = "Startup Idea Analysis" | |
subtitle.text = f"Idea: {idea}\nGenerated: {datetime.now().strftime('%B %d, %Y')}" | |
# --- Slide 2: Key Analysis --- | |
analysis_slide_layout = prs.slide_layouts[1] | |
slide = prs.slides.add_slide(analysis_slide_layout) | |
title = slide.shapes.title | |
body = slide.shapes.placeholders[1] | |
title.text = "Business Analysis Overview" | |
tf = body.text_frame | |
tf.clear() | |
for line in analysis_lines: | |
p = tf.add_paragraph() | |
p.text = line | |
p.font.size = Pt(14) | |
p.level = 0 | |
# --- Slide 3: Budget Analysis --- | |
budget_slide_layout = prs.slide_layouts[1] | |
slide = prs.slides.add_slide(budget_slide_layout) | |
title = slide.shapes.title | |
body = slide.shapes.placeholders[1] | |
title.text = "Financial Requirements" | |
tf = body.text_frame | |
tf.clear() | |
budget_info = generate_budget_analysis(domain, idea) | |
# Add startup costs | |
p = tf.add_paragraph() | |
p.text = "Initial Investment:" | |
p.font.size = Pt(16) | |
p.font.bold = True | |
p.level = 0 | |
for item, cost in list(budget_info["startup_costs"].items())[:4]: # Limit to first 4 items | |
p = tf.add_paragraph() | |
p.text = f"{item}: {cost}" | |
p.font.size = Pt(12) | |
p.level = 1 | |
# Add key financial metrics | |
p = tf.add_paragraph() | |
p.text = f"Expected Revenue: {budget_info['revenue_projection']}" | |
p.font.size = Pt(14) | |
p.level = 0 | |
p = tf.add_paragraph() | |
p.text = f"Break-even: {budget_info['break_even']}" | |
p.font.size = Pt(14) | |
p.level = 0 | |
# --- Slide 4: Key Features --- | |
features_slide_layout = prs.slide_layouts[1] | |
slide = prs.slides.add_slide(features_slide_layout) | |
title = slide.shapes.title | |
body = slide.shapes.placeholders[1] | |
title.text = "Essential Features" | |
tf = body.text_frame | |
tf.clear() | |
for feature in features: | |
p = tf.add_paragraph() | |
p.text = feature | |
p.font.size = Pt(14) | |
p.level = 0 | |
# --- Slide 5: Implementation Timeline --- | |
impl_slide_layout = prs.slide_layouts[1] | |
slide = prs.slides.add_slide(impl_slide_layout) | |
title = slide.shapes.title | |
body = slide.shapes.placeholders[1] | |
title.text = "Implementation Roadmap" | |
tf = body.text_frame | |
tf.clear() | |
# Show only key milestones to avoid overcrowding | |
key_steps = impl_steps[:6] # First 6 steps | |
for i, step in enumerate(key_steps, start=1): | |
p = tf.add_paragraph() | |
p.text = f"{i}. {step}" | |
p.font.size = Pt(11) | |
p.level = 0 | |
# --- Slide 6: Strategic Recommendations --- | |
suggestions_slide_layout = prs.slide_layouts[1] | |
slide = prs.slides.add_slide(suggestions_slide_layout) | |
title = slide.shapes.title | |
body = slide.shapes.placeholders[1] | |
title.text = "Strategic Recommendations" | |
tf = body.text_frame | |
tf.clear() | |
for s in suggestions[:5]: # Limit to 5 suggestions | |
p = tf.add_paragraph() | |
p.text = s | |
p.font.size = Pt(12) | |
p.level = 0 | |
# Save the presentation | |
fd, path = tempfile.mkstemp(suffix=".pptx") | |
os.close(fd) | |
prs.save(path) | |
output_path = os.path.join(tempfile.gettempdir(), f"Startup_Presentation_{datetime.now().strftime('%Y%m%d_%H%M%S')}.pptx") | |
shutil.copy(path, output_path) | |
return output_path | |
except Exception as e: | |
print(f"An error occurred while generating the PPT: {e}") | |
return None | |
# -------------------- Backend glue -------------------- | |
def validate_idea(idea): | |
if not idea.strip(): | |
errors = ["Please enter or select a valid startup idea."] * 7 | |
return (*errors, "Add 3-6 simple features that anyone can understand.", "", None, None) | |
analysis_lines, features, features_text, suggestions, domain = classify_and_analyze(idea) | |
impl_steps = implementation_plan(idea, domain) | |
pdf_path = generate_pdf(idea, analysis_lines, features, impl_steps, suggestions, domain) | |
ppt_path = generate_ppt(idea, analysis_lines, features, impl_steps, suggestions, domain) | |
suggestions_text = "\n".join(suggestions) | |
return (*analysis_lines, features_text, suggestions_text, pdf_path, ppt_path) | |
# -------------------- Samples -------------------- | |
sample_ideas = [ | |
"Vegetarian restaurant near popular temples and devotional sites.", | |
"Online store delivering milk, vegetables, and pooja items.", | |
"Mobile coffee stall near tech parks for working professionals.", | |
"Eco-friendly tiffin delivery using steel boxes near IT hubs.", | |
"Book vending machines at metro stations and spiritual fairs.", | |
"Local homestays for pilgrims with devotional guides and maps.", | |
"Temple-based souvenir shops with online delivery.", | |
"Pet grooming and care services in residential areas.", | |
"Home fitness training and nutrition coaching.", | |
"Online coding bootcamp for working professionals.", | |
"Solar panel installation and maintenance services.", | |
"Mobile handyman and repair services app" | |
] | |
# -------------------- UI -------------------- | |
with gr.Blocks(css=""" | |
.gradio-container { | |
background-image: url('https://media.istockphoto.com/id/1439748746/video/beautiful-gold-rain-centered-loopable-background-animation-glitter-and-light-beams-christmas.jpg?b=1&s=640x640&k=20&c=WaO9c87ruc2pWqHopzUlFGwYnjKWq0QKEU03JaF8eN8='); | |
background-size: center; | |
font-family: 'Segoe UI', sans-serif; | |
color: white; | |
} | |
.container { | |
background: rgba(0, 0, 0, 0.75); | |
padding: 30px; | |
border-radius: 15px; | |
max-width: 780px; | |
margin: auto; | |
} | |
.gr-button { | |
background-color: #2ecc71 !important; | |
color: white !important; | |
} | |
textarea, input, .gr-textbox textarea, .gr-textbox input { | |
color: #111 !important; | |
background: #fff !important; | |
} | |
label, .gr-form, .gr-block .label { | |
color: #fff !important; | |
} | |
.gr-html h1 { | |
color: white !important; | |
font-weight: bold !important; | |
} | |
""") as demo: | |
with gr.Column(elem_classes="container"): | |
gr.HTML("<h1 style='text-align:center;'>Idealyze — Validate Your Startup Idea</h1>") | |
idea_input = gr.Textbox( | |
label="Enter your Startup Idea", | |
placeholder="e.g., Eco-friendly tiffin delivery near tech parks." | |
) | |
validate_btn = gr.Button("Validate Idea") | |
gr.HTML("<h3>Or choose a sample idea below:</h3>") | |
dropdown = gr.Dropdown(choices=sample_ideas, label="Pick a Sample Idea", interactive=True) | |
outputs = [gr.Textbox(label=label, lines=2) for label in [ | |
"1. Domain", "2. Market Demand", "3. Target Audience", | |
"4. Competitor Analysis", "5. Revenue Model", | |
"6. Innovation Potential", "7. Build Possibility Score", | |
"8. Key Features (simple)", | |
"9. Strategic Suggestions" | |
]] | |
# Download components for both PDF and PPT | |
download_file_pdf = gr.File(label="Download Complete Analysis (PDF)") | |
download_file_ppt = gr.File(label="Download Presentation (PPT)") | |
validate_btn.click( | |
fn=validate_idea, | |
inputs=[idea_input], | |
outputs=outputs + [download_file_pdf, download_file_ppt] | |
) | |
dropdown.change( | |
fn=lambda x: x, | |
inputs=[dropdown], | |
outputs=[idea_input] | |
).then( | |
fn=validate_idea, | |
inputs=[idea_input], | |
outputs=outputs + [download_file_pdf, download_file_ppt] | |
) | |
demo.launch() |