|
|
--- |
|
|
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) |
|
|
``` |