Update README.md
Browse files
README.md
CHANGED
|
@@ -75,6 +75,27 @@ scores = (embeddings[:2] @ embeddings[2:].T) * 100
|
|
| 75 |
print(scores.tolist())
|
| 76 |
```
|
| 77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
|
| 79 |
## Evaluation Results
|
| 80 |
|
|
|
|
| 75 |
print(scores.tolist())
|
| 76 |
```
|
| 77 |
|
| 78 |
+
## Using with API
|
| 79 |
+
|
| 80 |
+
You can use the [embaas API](https://embaas.io) to encode your input. Get your free API key from [embaas.io](https://embaas.io)
|
| 81 |
+
|
| 82 |
+
import requests
|
| 83 |
+
|
| 84 |
+
url = "https://api.embaas.io/v1/embeddings/"
|
| 85 |
+
|
| 86 |
+
headers = {
|
| 87 |
+
"Content-Type": "application/json",
|
| 88 |
+
"Authorization": "Bearer ${YOUR_API_KEY}"
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
data = {
|
| 92 |
+
"texts": ["This is an example sentence.", "Here is another sentence."],
|
| 93 |
+
"instruction": "query"
|
| 94 |
+
"model": "multilingual-e5-base"
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
response = requests.post(url, json=data, headers=headers)
|
| 98 |
+
|
| 99 |
|
| 100 |
## Evaluation Results
|
| 101 |
|