gdn's picture
Demo App
9a48aae
# -*- coding: utf-8 -*-
"""Thera _QA.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1OhlAM33IIUg46ntfmrsQqQlIyCJGMi0k
"""
import gradio as gr
from transformers import pipeline
context = "Mental health is a state of well being in which the individual realizes his or her own abilities can cope with the normal stresses of life can work productively and fruitfully and is able to make a contribution to his or her community according to the World Health Organization Mental health includes subjective well being perceived self efficacy autonomy competence intergenerational dependence and self actualization of ones intellectual and emotional potential among others From the perspectives of positive psychology or holism mental health may include an individuals ability to enjoy life and to create a balance between life activities and efforts to achieve psychological resilience Cultural differences subjective assessments and competing professional theories all affect how one defines Some early signrelated to mental health problems are sleep irritation lack of energy and thinking of harming yourself or others"
question = "What are the mental health problems?"
question_answerer = pipeline("question-answering", model = "distilbert-base-cased-distilled-squad")
interface = gr.Interface.from_pipeline(question_answerer,
title = "question & answering demo on mental health",
theme = "peach",
examples = [[context, question]]).launch()