gauneg commited on
Commit
27979bb
1 Parent(s): d2dd34b

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +37 -0
README.md CHANGED
@@ -7,4 +7,41 @@ base_model:
7
  pipeline_tag: token-classification
8
  ---
9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
 
7
  pipeline_tag: token-classification
8
  ---
9
 
10
+ ## Usage
11
+
12
+ * Importing the libraries and loading the models and the pipeline
13
+ ```python
14
+ from transformers import AutoTokenizer, AutoModelForTokenClassification, pipeline
15
+ model_id = "gauneg/roberta-base-absa-ate-sentiment"
16
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
17
+ model = AutoModelForTokenClassification.from_pretrained(model_id)
18
+
19
+ ate_sent_pipeline = pipeline(task='ner',
20
+ aggregation_strategy='simple',
21
+ tokenizer=tokenizer,
22
+ model=model)
23
+
24
+
25
+
26
+ ```
27
+ * Using the pipeline object:
28
+ ```python
29
+ text_input = "Been here a few times and food has always been good but service really suffers when it gets crowded."
30
+ ate_sent_pipeline(text_input)
31
+ ```
32
+ * pipeline output:
33
+ ```bash
34
+ [{'entity_group': 'pos',
35
+ 'score': 0.8447307,
36
+ 'word': ' food',
37
+ 'start': 26,
38
+ 'end': 30},
39
+ {'entity_group': 'neg',
40
+ 'score': 0.81927896,
41
+ 'word': ' service',
42
+ 'start': 56,
43
+ 'end': 63}]
44
+
45
+ ```
46
+
47