File size: 1,709 Bytes
9fd257d
9822941
bf00be1
83239e8
232bfe2
 
 
dcdfdc9
bf00be1
1de6b92
b43dcc8
0ffee95
a4c568e
81eae11
 
 
100a421
0e33b88
3f4bcf2
57e3381
11b1ae5
57e3381
791fddb
14a3a73
d2a8971
f7e8972
90c0a18
 
 
 
 
 
 
 
 
 
 
 
ad27618
0e33b88
 
aa4ca43
 
 
 
cfb59c9
0e33b88
 
90c0a18
 
3f4bcf2
19fbc9e
073e6cc
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# 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"""


       
# Execute the chat functionality.           
 #       output = chain({"message": inp, "chat_history": history})["response"]        
 #       history.append((inp, output))     
 #       return history

with gr.Blocks(theme=gr.themes.Soft()) as demo:
    
  gr.HTML("<center><h2>Omdena AI Chatbot For Mental Health and Wellbeing</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."     
        )

  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)

  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)