366degrees commited on
Commit
40a451e
·
verified ·
1 Parent(s): eed07cd

Delete api_inference.py

Browse files
Files changed (1) hide show
  1. 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}