Updating code for predict entities
Browse files
README.md
CHANGED
@@ -52,10 +52,12 @@ This model is fine-tuned on the grocery-ner-dataset to identify 14 different cat
|
|
52 |
## Usage Example
|
53 |
|
54 |
```python
|
|
|
|
|
55 |
from gliner import GLiNER
|
56 |
|
57 |
# Load model
|
58 |
-
model = GLiNER.from_pretrained("empathyai/
|
59 |
|
60 |
labels = [
|
61 |
"Fruits Vegetables",
|
@@ -78,7 +80,7 @@ labels = [
|
|
78 |
text = "I need to buy milk, bread, and fresh apples"
|
79 |
|
80 |
# Get predictions
|
81 |
-
predictions = model.
|
82 |
print(predictions)
|
83 |
```
|
84 |
|
|
|
52 |
## Usage Example
|
53 |
|
54 |
```python
|
55 |
+
!pip install gliner
|
56 |
+
|
57 |
from gliner import GLiNER
|
58 |
|
59 |
# Load model
|
60 |
+
model = GLiNER.from_pretrained("empathyai/gliner_large-v2.5-groceries")
|
61 |
|
62 |
labels = [
|
63 |
"Fruits Vegetables",
|
|
|
80 |
text = "I need to buy milk, bread, and fresh apples"
|
81 |
|
82 |
# Get predictions
|
83 |
+
predictions = model.predict_entities(text, labels=labels)
|
84 |
print(predictions)
|
85 |
```
|
86 |
|