Feature Extraction
sentence-transformers
PyTorch
English
custom_snp
emotional-ai
reasoning-embedding
substrate-prism
cognitive-modeling
Instructions to use 366degrees/snp-universal-embedding with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use 366degrees/snp-universal-embedding with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("366degrees/snp-universal-embedding") sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Notebooks
- Google Colab
- Kaggle
Delete api_inference.py
Browse files- api_inference.py +0 -18
api_inference.py
DELETED
|
@@ -1,18 +0,0 @@
|
|
| 1 |
-
from sentence_transformers import SentenceTransformer
|
| 2 |
-
import torch
|
| 3 |
-
|
| 4 |
-
# Load your SNP-Universal-Embedding model (replace with your path if local)
|
| 5 |
-
model = SentenceTransformer("sentence-transformers/all-MiniLM-L6-v2")
|
| 6 |
-
|
| 7 |
-
def predict(inputs: dict):
|
| 8 |
-
"""
|
| 9 |
-
Hugging Face Inference API compatible function.
|
| 10 |
-
Receives: {"inputs": "your text here"} or {"inputs": ["text1", "text2"]}
|
| 11 |
-
Returns: {"embeddings": [[...], [...]]}
|
| 12 |
-
"""
|
| 13 |
-
texts = inputs.get("inputs", [])
|
| 14 |
-
if isinstance(texts, str):
|
| 15 |
-
texts = [texts]
|
| 16 |
-
|
| 17 |
-
embeddings = model.encode(texts, convert_to_tensor=False, normalize_embeddings=True)
|
| 18 |
-
return {"embeddings": embeddings}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|