Ihor commited on
Commit
a4c658a
·
verified ·
1 Parent(s): 7972bc2

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +18 -3
README.md CHANGED
@@ -49,6 +49,21 @@ pip install git+https://github.com/urchade/GLiNER.git
49
  ---
50
 
51
  ## Usage
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
 
53
  ```python
54
  from gliner import GLiNER
@@ -61,7 +76,7 @@ text = (
61
  "develop and sell Wozniak's Apple I personal computer."
62
  )
63
 
64
- labels = ["person", "other"]
65
 
66
  model.run([text], labels, threshold=0.3, num_gen_sequences=1)
67
  ```
@@ -77,7 +92,7 @@ model.run([text], labels, threshold=0.3, num_gen_sequences=1)
77
  "start": 21,
78
  "end": 26,
79
  "text": "Apple",
80
- "label": "other",
81
  "score": 0.6795641779899597,
82
  "generated labels": ["Organization"]
83
  },
@@ -85,7 +100,7 @@ model.run([text], labels, threshold=0.3, num_gen_sequences=1)
85
  "start": 47,
86
  "end": 60,
87
  "text": "April 1, 1976",
88
- "label": "other",
89
  "score": 0.44296327233314514,
90
  "generated labels": ["Date"]
91
  },
 
49
  ---
50
 
51
  ## Usage
52
+ If you need an open ontology entity extraction use tag `label` in the list of labels, please check example below:
53
+
54
+ ```python
55
+ from gliner import GLiNER
56
+
57
+ model = GLiNER.from_pretrained("knowledgator/gliner-decoder-base-v1.0")
58
+
59
+ text = "Hugging Face is a company that advances and democratizes artificial intelligence through open source and science."
60
+
61
+ labels = ["label"]
62
+
63
+ model.predict_entities(text, labels, threshold=0.3, num_gen_sequences=1)
64
+ ```
65
+
66
+ If you need to run a model on many text and/or set some labels constraints, please check example below:
67
 
68
  ```python
69
  from gliner import GLiNER
 
76
  "develop and sell Wozniak's Apple I personal computer."
77
  )
78
 
79
+ labels = ["person", "company", "date"]
80
 
81
  model.run([text], labels, threshold=0.3, num_gen_sequences=1)
82
  ```
 
92
  "start": 21,
93
  "end": 26,
94
  "text": "Apple",
95
+ "label": "company",
96
  "score": 0.6795641779899597,
97
  "generated labels": ["Organization"]
98
  },
 
100
  "start": 47,
101
  "end": 60,
102
  "text": "April 1, 1976",
103
+ "label": "date",
104
  "score": 0.44296327233314514,
105
  "generated labels": ["Date"]
106
  },