File size: 1,087 Bytes
5a9a528 5018417 63f06ad 5018417 5a9a528 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
---
license: "mit"
widget:
- 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."
---
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.
Example usage:
```python
import torch
import tensorflow as tf
from transformers import RobertaTokenizer, RobertaModel
from transformers import AutoModelForSequenceClassification
from transformers import TFAutoModelForSequenceClassification
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("hellomattnewman/msba-adrida")
model = AutoModelForSequenceClassification.from_pretrained("hellomattnewman/msba-adrida")
def adr_predict(x):
encoded_input = tokenizer(x, return_tensors='pt')
output = model(**encoded_input)
scores = output[0][0].detach().numpy()
scores = tf.nn.softmax(scores)
return scores.numpy()[1]
sentence = "I have severe pain."
adr_predict(sentence)
```
|