# Import dependencies
import os
import gradio as gr
from llama_index import GPTVectorStoreIndex
# from response import get_response
openai_api_key = os.getenv('OPENAI_API_KEY')
"""class ChatWrapper:
def __call__(
self, inp: str, history: str, chain
):
Execute the chat functionality.
output = chain({"question": inp, "chat_history": history})["answer"]
history.append((inp, output))
return history, history
chat = ChatWrapper()"""
chatbot = gr.Chatbot()
def get_response(message):
response = (f"You entered: {inp}")
return response
block = gr.Blocks(css=".gradio-container {background-color: lightblue}")
with block:
gr.HTML("
Omdena AI Chatbot For Mental Health and Well Being
")
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."
)
with gr.Row():
message = gr.Textbox(
label="What would you like to talk about?",
type = "text",
)
with gr.Row():
submit = gr.Button(color="lightblue", value="Send", variant="secondary").style(full_width=False)
submit.click(on_button_click, [message])
gr.Examples(
examples=[
"I feel lonely",
"I'm having problems at home",
"I am looking for some resources",
],
inputs=message,
)
submit.click(get_response, inputs=[message], outputs=[chatbot])
block.launch(debug=True)