Update README.md
Browse files
README.md
CHANGED
@@ -34,6 +34,30 @@ embeddings = model.encode(sentences)
|
|
34 |
print(embeddings)
|
35 |
```
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
|
39 |
## Usage (HuggingFace Transformers)
|
|
|
34 |
print(embeddings)
|
35 |
```
|
36 |
|
37 |
+
or by using API like this:
|
38 |
+
|
39 |
+
```python
|
40 |
+
import requests
|
41 |
+
|
42 |
+
API_URL = "https://api-inference.huggingface.co/models/Ketan3101/sentensense"
|
43 |
+
headers = {"Authorization": "Bearer Your token"}
|
44 |
+
|
45 |
+
def query(payload):
|
46 |
+
response = requests.post(API_URL, headers=headers, json=payload)
|
47 |
+
return response.json()
|
48 |
+
|
49 |
+
output = query({
|
50 |
+
"inputs": {
|
51 |
+
"source_sentence": "That is a happy person",
|
52 |
+
"sentences": [
|
53 |
+
"That is a happy dog",
|
54 |
+
"That is a very happy person",
|
55 |
+
"Today is a sunny day"
|
56 |
+
]
|
57 |
+
},
|
58 |
+
})
|
59 |
+
```
|
60 |
+
|
61 |
|
62 |
|
63 |
## Usage (HuggingFace Transformers)
|