File size: 915 Bytes
94a7329 0a4a190 3bdc77c ecad111 3bdc77c 59e90a1 3bdc77c 57f2642 3bdc77c 5d8c405 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
---
license: "mit"
---
This model takes text (up to a few sentences) and predicts whether the text contains resilience messaging. Resilience messaging is a text message that is about being able to a) "adapt to change” and b) “bounce back after illness or hardship". The predictive model is a fine-tuned RoBERTa NLP model. To see example use cases, please visit https://huggingface.co/spaces/paragon-analytics/ResText.
Example classification:
```python
import torch
import tensorflow as tf
from transformers import AutoModelForSequenceClassification, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("paragon-analytics/bert_resil")
model = AutoModelForSequenceClassification.from_pretrained("paragon-analytics/bert_resil")
encoded_input = tokenizer("We will survive this.", return_tensors='pt')
output = model(**encoded_input)
scores = output[0][0].detach().numpy()
scores = tf.nn.softmax(scores)
``` |