import gradio as gr from sentence_transformers import SentenceTransformer, util import numpy as np # Load embedding model model = SentenceTransformer("Qwen/Qwen3-Embedding-0.6B") # Sample startup goals (can be expanded) known_goals = [ "Build an MVP for a fintech app helping freelancers manage taxes", "Create a marketplace for local home service providers", "Launch a SaaS dashboard for tracking team productivity", "Build a platform to connect investors and climate-tech startups", "Create an AI tool that helps students summarize academic papers", "Develop a B2B tool to automate invoice reconciliation", ] # Sample advice linked to each goal advice_lookup = { known_goals[0]: "Use Stripe + Plaid for finance infra. Focus on freelancer pain points first.", known_goals[1]: "Start with one city. Validate supply-demand balance before scaling.", known_goals[2]: "Build Notion-style prototypes first. Talk to HR managers in startups.", known_goals[3]: "Target funds with ESG mandates. Find pilot customers in VC portfolios.", known_goals[4]: "Use GPT + citation tools. Talk to students and professors for feedback.", known_goals[5]: "Integrate with QuickBooks early. Focus on finance teams at SMEs.", } # Pre-compute known embeddings known_embeddings = model.encode(known_goals) # Define logic def find_similar_advice(user_goal): input_embedding = model.encode([user_goal]) scores = util.cos_sim(input_embedding, known_embeddings)[0].cpu().numpy() top_indices = np.argsort(scores)[::-1][:3] result = "" for i in top_indices: goal = known_goals[i] advice = advice_lookup[goal] result += f"🎯 **Similar Goal**: {goal}\n💡 **Advice**: {advice}\n\n" return result # Gradio UI demo = gr.Interface( fn=find_similar_advice, inputs=gr.Textbox(label="Describe your startup goal", placeholder="e.g. Build a fintech app for freelancers"), outputs=gr.Markdown(), title="🧠 AI Cofounder Similarity Coach", description="Get matched with similar startup goals and actionable advice using Qwen3 Embeddings" ) demo.launch()