# Import dependencies import gradio as gr import os from llama_index import GPTVectorStoreIndex from query_data import get_chain # Execute the chat functionality. output = chain({"message": inp, "chat_history": history})["response"] with gr.Blocks(theme=gr.themes.Soft()) as demo: gr.HTML("

Omdena AI Chatbot For Mental Health and Wellbeing

") gr.HTML("WELCOME
" "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." ) chatbot = gr.Chatbot() message = gr.Textbox(label="What would you like to chat about?") response = gr.Textbox def respond(message, chat_history): response = output 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) gr.Examples( examples=[ "I feel lonely", "I'm having problems at home", "I am looking for some resources", ], inputs=message ) send.click(respond, [message, chatbot], [message, chatbot]) clear.click(lambda: None, None, chatbot, queue=False) if __name__ == "__main__": demo.launch(debug=True)