patti-j's picture
Update app.py
90c0a18
raw
history blame
2.35 kB
# Import dependencies
import gradio as gr
"""import os
from llama_index import GPTVectorStoreIndex
from langchain.prompts.prompt import PromptTemplate
from langchain.llms import OpenAI
from langchain.chains import ChatVectorDBChain
from query_data import get_chain
from response import get_response"""
#_template = """Paraphrase the message and encourage to share more"""
#PARAPHRASE_MESSAGE_PROMPT= PromptTemplate.from_template(_template)
"""template = You are an AI psychotherapist. You are empathic and encourage humans to share. If asked for information,
provide it and then gently inquire if they want to talk about it. If you don't know the answer, just say
"Hmm, I'm not sure." Don't try to make up an answer. If the question is not about mental health or resources,
politely inform them that you are tuned to only answer questions about mental health and well being."""
# Execute the chat functionality.
# output = chain({"message": inp, "chat_history": history})["response"]
# history.append((inp, output))
# return history
""" gr.HTML("<center><h2>Omdena AI Chatbot For Mental Health and Well Being</h2></center>")
gr.HTML("WELCOME<br>"
"I am an AI ChatBot and I am here to assist you with whatever is bothering you. "
"Our conversation is strictly confidential and I will not remember it when you come back another time."
)
"""
with gr.Blocks(theme=gr.themes.Glass()) as demo:
title="Omdena AI Chatbot for Mental Health and Wellbeing"
description="description"
chatbot = gr.Chatbot()
message = gr.Textbox(label="What would you like to chat about?")
response = gr.Textbox
def respond(message, chat_history):
response = "Tell me more about that"
chat_history.append((message, response))
return "", chat_history
with gr.Row():
send = gr.Button(value="Send").style(full_width=False)
clear = gr.Button(value="Clear Chat").style(full_width=False)
examples=[
["I feel lonely"],
["I'm having problems at home"],
["I am looking for some resources"],
]
send.click(respond, [message, chatbot], [message, chatbot])
clear.click(lambda: None, None, chatbot, queue=False)
if __name__ == "__main__":
demo.launch(debug=True)