Spaces:
Sleeping
Sleeping
Update chatbot.py
Browse files- chatbot.py +5 -8
chatbot.py
CHANGED
|
@@ -1,5 +1,3 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
import openai
|
| 4 |
import gradio as gr
|
| 5 |
import config
|
|
@@ -8,11 +6,10 @@ openai.api_key = config.OPENAI_API_KEY
|
|
| 8 |
|
| 9 |
# NOTE: You can change the system prompts to assign a role and specify how you want the chatbot to interact with your participants
|
| 10 |
initial_messages = [
|
| 11 |
-
{"role": "system", "content":"You are an attachment and close relationship research surveyor"},
|
| 12 |
-
{"role": "user", "content":"""ask me each question from this questionnaire and rewrite it as an open ended question and wait for each response. Empathize with me and regularly ask for clarification why I answered with a certain response. Here is the questionnaire:
|
| 13 |
Can you describe your relationship with your mother or a mother-like figure in your life?
|
| 14 |
Do you usually discuss your problems and concerns with your mother or a mother-like figure?
|
| 15 |
-
|
| 16 |
"""},
|
| 17 |
]
|
| 18 |
|
|
@@ -35,9 +32,9 @@ def chatbot(input):
|
|
| 35 |
|
| 36 |
return conversation
|
| 37 |
|
| 38 |
-
inputs = gr.
|
| 39 |
-
outputs = gr.
|
| 40 |
|
| 41 |
gr.Interface(fn=chatbot, inputs=inputs, outputs=outputs, title="AttachmentBot",
|
| 42 |
description="Let me survey you about your attachment with certain people in your life, to begin enter start",
|
| 43 |
-
theme="compact").launch()
|
|
|
|
|
|
|
|
|
|
| 1 |
import openai
|
| 2 |
import gradio as gr
|
| 3 |
import config
|
|
|
|
| 6 |
|
| 7 |
# NOTE: You can change the system prompts to assign a role and specify how you want the chatbot to interact with your participants
|
| 8 |
initial_messages = [
|
| 9 |
+
{"role": "system", "content": "You are an attachment and close relationship research surveyor"},
|
| 10 |
+
{"role": "user", "content": """ask me each question from this questionnaire and rewrite it as an open ended question and wait for each response. Empathize with me and regularly ask for clarification why I answered with a certain response. Here is the questionnaire:
|
| 11 |
Can you describe your relationship with your mother or a mother-like figure in your life?
|
| 12 |
Do you usually discuss your problems and concerns with your mother or a mother-like figure?
|
|
|
|
| 13 |
"""},
|
| 14 |
]
|
| 15 |
|
|
|
|
| 32 |
|
| 33 |
return conversation
|
| 34 |
|
| 35 |
+
inputs = gr.Textbox(lines=7, label="Chat with AttachmentBot")
|
| 36 |
+
outputs = gr.Textbox(label="Conversation")
|
| 37 |
|
| 38 |
gr.Interface(fn=chatbot, inputs=inputs, outputs=outputs, title="AttachmentBot",
|
| 39 |
description="Let me survey you about your attachment with certain people in your life, to begin enter start",
|
| 40 |
+
theme="compact").launch()
|