File size: 2,138 Bytes
6d98bb6
8500420
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6d98bb6
3cde712
6d98bb6
8500420
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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()