Commit
·
f27ca70
1
Parent(s):
b0f0f55
Update README.md
Browse files
README.md
CHANGED
@@ -23,16 +23,7 @@ labelint = ['LABEL_0', 'LABEL_1', 'LABEL_2', 'LABEL_3', 'LABEL_4', 'LABEL_5', 'L
|
|
23 |
|
24 |
labeltxt = np.loadtxt("TASK2/label_vals/l1.txt", dtype="str")
|
25 |
|
26 |
-
(where labeltxt is : Agent
|
27 |
-
Device
|
28 |
-
Event
|
29 |
-
Place
|
30 |
-
Species
|
31 |
-
SportsSeason
|
32 |
-
TopicalConcept
|
33 |
-
UnitOfWork
|
34 |
-
Work
|
35 |
-
)
|
36 |
|
37 |
|
38 |
|
@@ -40,30 +31,23 @@ Work
|
|
40 |
### How to use
|
41 |
|
42 |
You can use this model directly with a pipeline:
|
43 |
-
|
44 |
-
from transformers import pipeline
|
45 |
-
import numpy as np
|
46 |
-
|
47 |
-
text = "This was a masterpiece. Not completely faithful to the books, but enthralling from beginning to end. Might be my favorite of the three."
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
for i in range(len(labelint)):
|
63 |
-
|
64 |
-
if output == labelint[i]:
|
65 |
-
|
66 |
-
print("Output is : " + str(labeltxt[i]))
|
67 |
|
68 |
### Limitations and bias
|
69 |
|
@@ -76,4 +60,3 @@ predictions. It also inherits some of
|
|
76 |
|
77 |
|
78 |
|
79 |
-
### BibTeX entry and citation info
|
|
|
23 |
|
24 |
labeltxt = np.loadtxt("TASK2/label_vals/l1.txt", dtype="str")
|
25 |
|
26 |
+
(where labeltxt is : Agent, Device, Event, Place, Species, SportsSeason, TopicalConcept, UnitOfWork, Work)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
|
29 |
|
|
|
31 |
### How to use
|
32 |
|
33 |
You can use this model directly with a pipeline:
|
34 |
+
```python
|
35 |
+
from transformers import pipeline
|
36 |
+
import numpy as np
|
37 |
+
|
38 |
+
text = "This was a masterpiece. Not completely faithful to the books, but enthralling from beginning to end. Might be my favorite of the three."
|
39 |
+
classifier = pipeline("text-classification", model="carbonnnnn/T2L1DISTILBERT")
|
40 |
+
labeltxt = np.loadtxt("TASK2/label_vals/l1.txt", dtype="str")
|
41 |
+
labelint = ['LABEL_0', 'LABEL_1', 'LABEL_2', 'LABEL_3', 'LABEL_4', 'LABEL_5', 'LABEL_6', 'LABEL_7', 'LABEL_8']
|
42 |
+
|
43 |
+
output = classifier(text)[0]['label']
|
44 |
+
|
45 |
+
for i in range(len(labelint)):
|
46 |
+
if output == labelint[i]:
|
47 |
+
print("Output is : " + str(labeltxt[i]))
|
48 |
+
|
49 |
+
```
|
50 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
|
52 |
### Limitations and bias
|
53 |
|
|
|
60 |
|
61 |
|
62 |
|
|