Update README.md
Browse files
README.md
CHANGED
@@ -10,7 +10,7 @@ The model is a fine-tuned version of [facebook/bart-base](https://huggingface.co
|
|
10 |
The model input is a set of sentences extracted by other sentence classifiers first, instead of directly using the full text of the section. The target output is the corresponding structured abstract.
|
11 |
|
12 |
|
13 |
-
```
|
14 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
15 |
|
16 |
# load model
|
@@ -19,10 +19,20 @@ tokenizer = AutoTokenizer.from_pretrained(model_name)
|
|
19 |
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
|
20 |
|
21 |
# example
|
22 |
-
text = """ Suicide is a major challenge for the public health system, accounting for over 800,000 deaths each year worldwide.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
inputs = tokenizer(text, truncation=True, return_tensors='pt').input_ids
|
25 |
outputs = model.generate(inputs)
|
26 |
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
27 |
|
|
|
28 |
```
|
|
|
10 |
The model input is a set of sentences extracted by other sentence classifiers first, instead of directly using the full text of the section. The target output is the corresponding structured abstract.
|
11 |
|
12 |
|
13 |
+
```python
|
14 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
15 |
|
16 |
# load model
|
|
|
19 |
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
|
20 |
|
21 |
# example
|
22 |
+
text = """ Suicide is a major challenge for the public health system, accounting for over 800,000 deaths each year worldwide.
|
23 |
+
Prisoners constitute such a risk group. Prisoners represent one extreme on the spectrum of delinquency, and are exposed to a particularly high risk of suicide, with suicide rates about 5 to 8 times higher than in the general population.
|
24 |
+
First, prisoners show behaviour and personality traits associated with suicide, even before imprisonment; these risk factors are imported into the prison environment.
|
25 |
+
The first weeks of imprisonment are particularly important for suicide prevention, since a considerable proportion of suicides in prisons occur during this period.
|
26 |
+
Only isolated studies have examined whether these factors are related to early suicide in prison, and these show a connection between drug addiction and early prison suicide.
|
27 |
+
To the best of our knowledge, this is the first study that uses a case-control design to investigate whether suicides in the first weeks of imprisonment differ from late prison suicide events in terms of their risk and resilience factors.
|
28 |
+
Previous prison sentences are negatively associated with early suicides, as this knowledge of the prison environment facilitates the process of re-adaptation.
|
29 |
+
Offences that are closely associated with drug use, such as theft, or offences against the narcotics law, are associated with early suicide events.
|
30 |
+
Evidence of mental illness or drug withdrawal is associated with early prison suicides. Assignment of a psychiatrist is protective against suicides during the first days of detention.
|
31 |
+
Risk factors change with increasing prison time. """
|
32 |
|
33 |
inputs = tokenizer(text, truncation=True, return_tensors='pt').input_ids
|
34 |
outputs = model.generate(inputs)
|
35 |
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
36 |
|
37 |
+
|
38 |
```
|