Creating a mental health resource chatbot with a deep neural network.

You: Hey Serenity, how are you? Serenity: Good Alisha! How can I help you? You: I want to learn more about Schizophrenia, what is Schizophrenia? Serenity: Schizophrenia is a serious psychiatric disorder characterized by the person slowly losing contact with reality, often experiencing delusions or hallucinations. You: I know someone who has Schizophrenia, what can I do to support them? Serenity: Here are some tips Alisha; Maintain a low-stress environment, Use language that is positive and supportive instead of critical, Have one person speak at a time and keep voices down.

The Basics


Deep Learning

Building a mental health educational chatbot

Step 1: Initializing Chatbot Training

Step 2: Building the Deep Learning Model

import tensorflow as tf  
from tensorflow.python.framework import ops
net = tflearn.input_data(shape=[None, len(training[0])])
net = tflearn.fully_connected(net, 8)
net = tflearn.fully_connected(net, 8)
net = tflearn.fully_connected(net, len(output[0]), activation='softmax')
net = tflearn.regression(net)
model = tflearn.DNN(net)
except:, output, n_epoch=1000, batch_size=8, show_metric=True)'model.tflearn')

Step 3: Building the Chatbot

def chat():
print("Start talking with the bot(type quit to stop)!")
while True:
inp = input('You:')
if inp.lower() == 'quit':
results = model.predict([bag_of_words(inp, words)])
results_index = numpy.argmaz(results)
tag = labels[results_index]
for tg in data ["intents"]
if tg ['tag'] == tag:
responses = tg['responses']


You: Hi Serentiy  
Serenity: Hi Alisha, how can I help you?
You: What are some symptoms of depression?
Serenity: Here are some symptoms of depression: Hopeless outlook, Lost interest, Increased fatigue, Suicidal thoughts, and Anxiety
You: What italian restaurants should I try in Toronto?
Serenity: Unfortunately, I do not have an answer for that.

The Future

  • Share it with your network 🙏
  • Connect with me on Linkedin to stay updated on my AI journey, and shoot me a message (I love meeting new people).
  • Subscribe to my newsletter, for monthly updates on what I’m working on!



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alisha Arora

Alisha Arora

15 yo futurist, change maker and innovator at The Knowledge Society.