Update README.md
Browse files
README.md
CHANGED
|
@@ -33,13 +33,11 @@ The model leverages the BertForSequenceClassification architecture, It has been
|
|
| 33 |
|
| 34 |
## Example
|
| 35 |
|
|
|
|
| 36 |
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
| 37 |
-
|
| 38 |
import numpy as np
|
| 39 |
-
|
| 40 |
from scipy.special import expit
|
| 41 |
|
| 42 |
-
|
| 43 |
MODEL = "PavanDeepak/Topic_Classification"
|
| 44 |
tokenizer = AutoTokenizer.from_pretrained(MODEL)
|
| 45 |
model = AutoModelForSequenceClassification.from_pretrained(MODEL)
|
|
@@ -54,10 +52,9 @@ scores = expit(scores)
|
|
| 54 |
predictions = (scores >= 0.5) * 1
|
| 55 |
|
| 56 |
for i in range(len(predictions)):
|
| 57 |
-
|
| 58 |
if predictions[i]:
|
| 59 |
-
|
| 60 |
print(class_mapping[i])
|
|
|
|
| 61 |
|
| 62 |
|
| 63 |
## Output:
|
|
|
|
| 33 |
|
| 34 |
## Example
|
| 35 |
|
| 36 |
+
```python
|
| 37 |
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
|
|
|
| 38 |
import numpy as np
|
|
|
|
| 39 |
from scipy.special import expit
|
| 40 |
|
|
|
|
| 41 |
MODEL = "PavanDeepak/Topic_Classification"
|
| 42 |
tokenizer = AutoTokenizer.from_pretrained(MODEL)
|
| 43 |
model = AutoModelForSequenceClassification.from_pretrained(MODEL)
|
|
|
|
| 52 |
predictions = (scores >= 0.5) * 1
|
| 53 |
|
| 54 |
for i in range(len(predictions)):
|
|
|
|
| 55 |
if predictions[i]:
|
|
|
|
| 56 |
print(class_mapping[i])
|
| 57 |
+
```python
|
| 58 |
|
| 59 |
|
| 60 |
## Output:
|