Update README.md
Browse files
README.md
CHANGED
@@ -26,19 +26,21 @@ txtai must be [installed](https://neuml.github.io/txtai/install/) to use this mo
|
|
26 |
|
27 |
```python
|
28 |
from txtai.embeddings import Embeddings
|
|
|
29 |
|
30 |
# Load the index from the HF Hub
|
31 |
embeddings = Embeddings()
|
32 |
embeddings.load(provider="huggingface-hub", container="burgerbee/txtai-sv-wikipedia")
|
33 |
|
34 |
# Run a search
|
35 |
-
embeddings.search("
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
-
# Run a search matching only the Top 1% of articles
|
38 |
-
embeddings.search("""
|
39 |
-
SELECT id, text, score, percentile FROM txtai WHERE similar('Boston') AND
|
40 |
-
percentile >= 0.99
|
41 |
-
""")
|
42 |
```
|
43 |
|
44 |
## Use Cases
|
|
|
26 |
|
27 |
```python
|
28 |
from txtai.embeddings import Embeddings
|
29 |
+
import json
|
30 |
|
31 |
# Load the index from the HF Hub
|
32 |
embeddings = Embeddings()
|
33 |
embeddings.load(provider="huggingface-hub", container="burgerbee/txtai-sv-wikipedia")
|
34 |
|
35 |
# Run a search
|
36 |
+
for x in embeddings.search("I vilken stad ligger Liseberg?", 1):
|
37 |
+
print(json.dumps(x, indent=2))
|
38 |
+
|
39 |
+
|
40 |
+
# Run a search and filter on popular results (page views).
|
41 |
+
for x in embeddings.search("SELECT id, text, score, percentile FROM txtai WHERE similar('I vilken stad ligger Liseberg?') AND percentile >= 0.99", 1):
|
42 |
+
print(json.dumps(x, indent=2))
|
43 |
|
|
|
|
|
|
|
|
|
|
|
44 |
```
|
45 |
|
46 |
## Use Cases
|