# -*- coding: utf-8 -*- """Extractive_UWC_Case_History_Summarization.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1D2eqhloS0uZR5jXlRGvm10uibWdz2L4g # **Texts** """ text1 = """The adolescent was previously diagnosed with major depressive disorder and treated intermittently with supportive psychotherapy and antidepressants. Her more recent episodes related to her parents’ marital problems and her academic/social difficulties at school. She was treated using cognitive-behavioral therapy (CBT).""" text2 = """Sam was team captain of his soccer team, but an unexpected fight with another teammate prompted his parents to meet with a clinical psychologist. Sam was diagnosed with major depressive disorder after showing an increase in symptoms over the previous three months. Several recent challenges in his family and romantic life led the therapist to recommend interpersonal psychotherapy for adolescents (IPT-A).""" text3 = """Mark had a history of depression and sought treatment after his second marriage ended. His depression was characterized as being “controlled by a pattern of interpersonal avoidance.” The behavior/activation therapist asked Mark to complete an activity record to help steer the treatment sessions.""" text4 = """Denise is described as having “nonchronic depression” which appeared most recently at the onset of her husband’s diagnosis with brain cancer. Her symptoms were loneliness, difficulty coping with daily life, and sadness. Treatment included filling out a weekly activity log and identifying/reconstructing automatic thoughts.""" text5 ="""Luke is described as having treatment-resistant depression and while not suicidal, hoped that a fatal illness would take his life or that he would just disappear. His treatment involved mindfulness-based cognitive therapy, which helps participants become aware of and recharacterize their overwhelming negative thoughts. It involves regular practice of mindfulness techniques and exercises as one component of therapy.""" text6 ="""Peggy had a history of chronic depression, which flared during her husband’s illness and ultimate death. Guilt was a driving factor of her depressive symptoms, which lasted six months after his death. The clinician treated Peggy with psychodynamic therapy over a period of two years.""" """# **Extractive Summarization** """ from summarizer import Summarizer bert_model = Summarizer() # text = """One month after the United States began what has become a troubled rollout of a national COVID vaccination campaign, the effort is finally gathering real steam. # Close to a million doses -- over 951,000, to be more exact -- made their way into the arms of Americans in the past 24 hours, the U.S. Centers for Disease Control and Prevention reported Wednesday. That's the largest number of shots given in one day since the rollout began and a big jump from the previous day, when just under 340,000 doses were given, CBS News reported. # That number is likely to jump quickly after the federal government on Tuesday gave states the OK to vaccinate anyone over 65 and said it would release all the doses of vaccine it has available for distribution. Meanwhile, a number of states have now opened mass vaccination sites in an effort to get larger numbers of people inoculated, CBS News reported.""" def abstractive_text(text): summary_text = bert_model(text, ratio=0.1) return summary_text iface = gr.Interface(fn=abstractive_text, inputs= ["text"],outputs=["text"],title="Case summary generation") iface.launch(share=True)