Spaces:
Sleeping
Sleeping
NN changes
Browse files
app.py
CHANGED
@@ -114,11 +114,12 @@ def respond(message, history, mom_type) :
|
|
114 |
if not mom_type:
|
115 |
return "Please choose atleast one mom"
|
116 |
selected = mom_type[0]
|
117 |
-
|
|
|
118 |
top_results = get_top_chunks(message, cool_chunk_embeddings, cleaned_cool_chunks)
|
119 |
-
elif
|
120 |
top_results = get_top_chunks(message, tutor_chunk_embeddings, cleaned_tutor_chunks)
|
121 |
-
elif
|
122 |
top_results = get_top_chunks(message, strict_chunk_embeddings, cleaned_strict_chunks)
|
123 |
|
124 |
messages = [{"role": "system", "content": f"You are chatbot that plays the role of the user's extremely studious, tutor-like mom. Respond in full sentences, don't cut yourself off. Base your response on the provided context: {mom_type}"},
|
@@ -137,7 +138,8 @@ def respond(message, history, mom_type) :
|
|
137 |
)
|
138 |
return response['choices'][0]['message']['content'].strip()
|
139 |
|
140 |
-
|
|
|
141 |
|
142 |
with gr.Blocks() as chatbot:
|
143 |
with gr.Row():
|
|
|
114 |
if not mom_type:
|
115 |
return "Please choose atleast one mom"
|
116 |
selected = mom_type[0]
|
117 |
+
# NN changed from mom_type to selected in each if statement
|
118 |
+
if selected == "Cool Mom" :
|
119 |
top_results = get_top_chunks(message, cool_chunk_embeddings, cleaned_cool_chunks)
|
120 |
+
elif selected == "Tutor Mom" :
|
121 |
top_results = get_top_chunks(message, tutor_chunk_embeddings, cleaned_tutor_chunks)
|
122 |
+
elif selected == "Strict Mom":
|
123 |
top_results = get_top_chunks(message, strict_chunk_embeddings, cleaned_strict_chunks)
|
124 |
|
125 |
messages = [{"role": "system", "content": f"You are chatbot that plays the role of the user's extremely studious, tutor-like mom. Respond in full sentences, don't cut yourself off. Base your response on the provided context: {mom_type}"},
|
|
|
138 |
)
|
139 |
return response['choices'][0]['message']['content'].strip()
|
140 |
|
141 |
+
# NN commented out
|
142 |
+
# chatbot = gr.ChatInterface(respond, type="messages")
|
143 |
|
144 |
with gr.Blocks() as chatbot:
|
145 |
with gr.Row():
|