Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
# Import dependencies
|
2 |
-
import os
|
3 |
import gradio as gr
|
|
|
4 |
from llama_index import GPTVectorStoreIndex
|
5 |
from langchain.prompts.prompt import PromptTemplate
|
6 |
from langchain.llms import OpenAI
|
7 |
from langchain.chains import ChatVectorDBChain
|
8 |
from query_data import get_chain
|
9 |
-
from response import get_response
|
10 |
|
11 |
_template = """Paraphrase the message and encourage to share more"""
|
12 |
PARAPHRASE_MESSAGE_PROMPT= PromptTemplate.from_template(_template)
|
@@ -26,8 +26,7 @@ def respond(message, chat_history):
|
|
26 |
# history.append((inp, output))
|
27 |
# return history
|
28 |
|
29 |
-
with gr.Blocks(theme=gr.themes.
|
30 |
-
|
31 |
|
32 |
gr.HTML("<center><h2>Omdena AI Chatbot For Mental Health and Well Being</h2></center>")
|
33 |
|
@@ -41,12 +40,13 @@ with gr.Blocks(theme=gr.themes.Glass()) as demo:
|
|
41 |
label="What would you like to talk about?",
|
42 |
type = "text",
|
43 |
)
|
|
|
44 |
|
45 |
with gr.Row():
|
46 |
-
submit = gr.Button(value="Send"
|
47 |
-
# submit.click(lambda: None, None, chatbot, queue=False)
|
48 |
clear = gr.Button(value="Clear Chat")
|
49 |
-
|
|
|
50 |
gr.Examples(
|
51 |
examples=[
|
52 |
"I feel lonely",
|
@@ -57,7 +57,8 @@ with gr.Blocks(theme=gr.themes.Glass()) as demo:
|
|
57 |
)
|
58 |
|
59 |
chatbot = gr.Chatbot()
|
60 |
-
message.submit(respond, [message, chatbot], [
|
|
|
61 |
|
62 |
if __name__ == "__main__":
|
63 |
demo.launch(debug=True)
|
|
|
1 |
# Import dependencies
|
|
|
2 |
import gradio as gr
|
3 |
+
"""import os
|
4 |
from llama_index import GPTVectorStoreIndex
|
5 |
from langchain.prompts.prompt import PromptTemplate
|
6 |
from langchain.llms import OpenAI
|
7 |
from langchain.chains import ChatVectorDBChain
|
8 |
from query_data import get_chain
|
9 |
+
from response import get_response"""
|
10 |
|
11 |
_template = """Paraphrase the message and encourage to share more"""
|
12 |
PARAPHRASE_MESSAGE_PROMPT= PromptTemplate.from_template(_template)
|
|
|
26 |
# history.append((inp, output))
|
27 |
# return history
|
28 |
|
29 |
+
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
|
30 |
|
31 |
gr.HTML("<center><h2>Omdena AI Chatbot For Mental Health and Well Being</h2></center>")
|
32 |
|
|
|
40 |
label="What would you like to talk about?",
|
41 |
type = "text",
|
42 |
)
|
43 |
+
response = gr.Textbox(label="Reply")
|
44 |
|
45 |
with gr.Row():
|
46 |
+
submit = gr.Button(value="Send")
|
|
|
47 |
clear = gr.Button(value="Clear Chat")
|
48 |
+
|
49 |
+
|
50 |
gr.Examples(
|
51 |
examples=[
|
52 |
"I feel lonely",
|
|
|
57 |
)
|
58 |
|
59 |
chatbot = gr.Chatbot()
|
60 |
+
message.submit(respond, [message, chatbot], [response, chatbot])
|
61 |
+
clear.click(lambda: None, None, chatbot, queue=False)
|
62 |
|
63 |
if __name__ == "__main__":
|
64 |
demo.launch(debug=True)
|