Semantic search model for SaaS product recommendation. Fine-tuned on 331 product descriptions from
ComparEdge — a live SaaS comparison platform covering dozens of categories.
Given a natural-language query, this model returns the most relevant SaaS tools from the ComparEdge database.
1from sentence_transformers import SentenceTransformer
2from sentence_transformers.util import cos_sim
3from huggingface_hub import hf_hub_download
4import numpy as np, json, torch
5
6model = SentenceTransformer("ComparEdge/saas-product-matcher")
7
8# Load pre-computed embeddings (hundreds of products, no re-encoding needed)
9emb_path = hf_hub_download("ComparEdge/saas-product-matcher", "product_embeddings.npy")
10idx_path = hf_hub_download("ComparEdge/saas-product-matcher", "products_index.json")
11
12embeddings = np.load(emb_path)
13with open(idx_path) as f:
14 products = json.load(f)
15
16query = "I need a CRM for a small startup"
17q_emb = model.encode(query, normalize_embeddings=True)
18scores = cos_sim(torch.tensor(q_emb), torch.tensor(embeddings))[0]
19top_idx = scores.argsort(descending=True)[:5]
20
21for idx in top_idx:
22 p = products[idx]
23 print(f"{p['name']} ({p['category']}): {scores[idx]:.3f}")
24 print(f" → https://comparedge.com/tools/{p['slug']}")