yongsun-yoon
commited on
Commit
•
a709768
1
Parent(s):
4d5493e
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
```python
|
3 |
+
from transformers import pipeline
|
4 |
+
|
5 |
+
nlp = pipeline('token-classification', 'yongsun-yoon/deberta-v3-base-open-ner', aggregation_strategy='simple')
|
6 |
+
|
7 |
+
text = 'Heat the olive oil in a frying pan, add the onion and cook for 5 minutes until softened and starting to turn golden. Set aside.'
|
8 |
+
entity_type = 'ingredient'
|
9 |
+
input_text = f'{text}{nlp.tokenizer.sep_token}{entity_type}' # [SEP]
|
10 |
+
|
11 |
+
nlp(input_text) # olive oil, onion
|
12 |
+
```
|