Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -26,14 +26,16 @@ def transcribe(audio):
|
|
26 |
#for message in msg_contents:
|
27 |
# if (message["role"] != "system"):
|
28 |
# chat_transcript += message["role"] + ": " + message["content"] + "\n\n"
|
29 |
-
|
30 |
|
31 |
-
return
|
32 |
|
33 |
def botResponse(user_input):
|
34 |
response = openai.ChatCompletion.create(
|
35 |
model="gpt-3.5-turbo",
|
36 |
-
messages=user_input)
|
|
|
|
|
37 |
|
38 |
system_message = response["choices"][0]["message"]["content"]
|
39 |
#msg_contents.append({"role": "assistant", "content": system_message})
|
|
|
26 |
#for message in msg_contents:
|
27 |
# if (message["role"] != "system"):
|
28 |
# chat_transcript += message["role"] + ": " + message["content"] + "\n\n"
|
29 |
+
system_response = botResponse(transcript["text"])
|
30 |
|
31 |
+
return system_response
|
32 |
|
33 |
def botResponse(user_input):
|
34 |
response = openai.ChatCompletion.create(
|
35 |
model="gpt-3.5-turbo",
|
36 |
+
#messages=user_input)
|
37 |
+
messages=[{"role": "system", "content": "You are a therapist. Respond in less than 5 sentences."},
|
38 |
+
{"role": "user", "content": user_input["text"]}]
|
39 |
|
40 |
system_message = response["choices"][0]["message"]["content"]
|
41 |
#msg_contents.append({"role": "assistant", "content": system_message})
|