Sentence Similarity
sentence-transformers
Safetensors
English
bert
feature-extraction
saas
product-recommendation
semantic-search
text-embeddings-inference
Instructions to use ComparEdge/saas-product-matcher with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use ComparEdge/saas-product-matcher with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("ComparEdge/saas-product-matcher") sentences = [ "That is a happy person", "That is a happy dog", "That is a very happy person", "Today is a sunny day" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Notebooks
- Google Colab
- Kaggle
| #!/usr/bin/env python3 | |
| """ | |
| Standalone semantic search for ComparEdge SaaS Product Matcher. | |
| Install: pip install sentence-transformers numpy huggingface_hub torch | |
| Usage: python example_search.py "best CRM for small team" | |
| """ | |
| import sys, json | |
| import numpy as np | |
| import torch | |
| from sentence_transformers import SentenceTransformer | |
| from sentence_transformers.util import cos_sim | |
| from huggingface_hub import hf_hub_download | |
| MODEL_ID = "ComparEdge/saas-product-matcher" | |
| def main(): | |
| query = " ".join(sys.argv[1:]) if len(sys.argv) > 1 else "best project management tool" | |
| print(f"Loading {MODEL_ID}...") | |
| model = SentenceTransformer(MODEL_ID) | |
| emb_path = hf_hub_download(MODEL_ID, "product_embeddings.npy") | |
| idx_path = hf_hub_download(MODEL_ID, "products_index.json") | |
| embeddings = np.load(emb_path) | |
| with open(idx_path) as f: | |
| products = json.load(f) | |
| q_emb = model.encode(query, normalize_embeddings=True) | |
| scores = cos_sim(torch.tensor(q_emb), torch.tensor(embeddings))[0] | |
| top_idx = scores.argsort(descending=True)[:5] | |
| print(f"\nTop matches for: \"{query}\"") | |
| print("-" * 60) | |
| for i, idx in enumerate(top_idx): | |
| p = products[idx] | |
| print(f"{i+1}. {p['name']} ({p['category']})") | |
| print(f" Score : {scores[idx]:.3f}") | |
| print(f" About : {p['description']}") | |
| print(f" Link : https://comparedge.com/tools/{p['slug']}") | |
| print() | |
| if __name__ == "__main__": | |
| main() | |