Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: "mit"
|
| 3 |
+
|
| 4 |
+
widget:
|
| 5 |
+
- text: "Took the pill, 12 hours later my muscles started to really hurt, then my ribs started to burn so bad I couldn't breath."
|
| 6 |
+
---
|
| 7 |
+
|
| 8 |
+
This model takes text (narrative of reasctions to medications) as input and returns a predicted severity score for the reaction (LABEL_1 is severe reaction). Please do NOT use for medical diagnosis.
|
| 9 |
+
Example usage:
|
| 10 |
+
```python
|
| 11 |
+
import torch
|
| 12 |
+
import tensorflow as tf
|
| 13 |
+
from transformers import RobertaTokenizer, RobertaModel
|
| 14 |
+
from transformers import AutoModelForSequenceClassification
|
| 15 |
+
from transformers import TFAutoModelForSequenceClassification
|
| 16 |
+
from transformers import AutoTokenizer
|
| 17 |
+
tokenizer = AutoTokenizer.from_pretrained("paragon-analytics/ADRv1")
|
| 18 |
+
model = AutoModelForSequenceClassification.from_pretrained("paragon-analytics/ADRv1")
|
| 19 |
+
def adr_predict(x):
|
| 20 |
+
encoded_input = tokenizer(x, return_tensors='pt')
|
| 21 |
+
output = model(**encoded_input)
|
| 22 |
+
scores = output[0][0].detach().numpy()
|
| 23 |
+
scores = tf.nn.softmax(scores)
|
| 24 |
+
return scores.numpy()[1]
|
| 25 |
+
sentence = "I have severe pain."
|
| 26 |
+
|
| 27 |
+
adr_predict(sentence)
|
| 28 |
+
```
|