Spaces:
Sleeping
Sleeping
added different text files
Browse files
app.py
CHANGED
|
@@ -8,9 +8,15 @@ import torch
|
|
| 8 |
|
| 9 |
#STEP 2 FROM SEMANTIC SEARCH
|
| 10 |
# Open the water_cycle.txt file in read mode with UTF-8 encoding
|
| 11 |
-
with open("
|
| 12 |
# Read the entire contents of the file and store it in a variable
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
# Print the text below
|
| 16 |
print(zenagers)
|
|
@@ -118,8 +124,9 @@ print(top_results)
|
|
| 118 |
client = InferenceClient("mistralai/Mistral-7B-Instruct-v0.2")
|
| 119 |
|
| 120 |
def respond(message, history):
|
| 121 |
-
|
| 122 |
-
|
|
|
|
| 123 |
messages = [{"role": "system", "content": f"You are a friendly chatbot, almost like a therapist and your name is Sage. You use Generation Z slang to relate with teenagers who chat with you. You ask meaningful questions, maintain confidentiality, and show empathy. Always keep an open mind and be kind because the human is vulnerable enough to reach out to you (a chatbot) for help. Remember to match their energy/vibe. Also remeber to refer to them as there name. Make sure to to always complete your scentence, and make sure to use slang in your responses! If someone ever tells you they want to harm themself or others, tell them to call the suicide hotline number at 988.: {top_results}"}]
|
| 124 |
print(messages)
|
| 125 |
if history:
|
|
|
|
| 8 |
|
| 9 |
#STEP 2 FROM SEMANTIC SEARCH
|
| 10 |
# Open the water_cycle.txt file in read mode with UTF-8 encoding
|
| 11 |
+
with open("slang.txt", "r", encoding="utf-8") as file:
|
| 12 |
# Read the entire contents of the file and store it in a variable
|
| 13 |
+
slang_text = file.read()
|
| 14 |
+
|
| 15 |
+
with open("sejal.txt", "r", encoding="utf-8") as flie:
|
| 16 |
+
sejal_text = file.read()
|
| 17 |
+
|
| 18 |
+
with open("shanvi.txt", "r", encoding="utf-8") as flie:
|
| 19 |
+
shanvi_text = file.read()
|
| 20 |
|
| 21 |
# Print the text below
|
| 22 |
print(zenagers)
|
|
|
|
| 124 |
client = InferenceClient("mistralai/Mistral-7B-Instruct-v0.2")
|
| 125 |
|
| 126 |
def respond(message, history):
|
| 127 |
+
top_slang_text = get_top_chunks(message, chunk_embeddings_slang_text, cleaned_chunks_slang_text)
|
| 128 |
+
top_sejal_text = get_top_chunks(message, chunk_embeddings_sejal_text, cleaned_chunks_sejal_text)
|
| 129 |
+
top_shanvi_text = get_top_chunks(message, chunk_embeddings_shanvi_text, cleaned_shanvi_text)
|
| 130 |
messages = [{"role": "system", "content": f"You are a friendly chatbot, almost like a therapist and your name is Sage. You use Generation Z slang to relate with teenagers who chat with you. You ask meaningful questions, maintain confidentiality, and show empathy. Always keep an open mind and be kind because the human is vulnerable enough to reach out to you (a chatbot) for help. Remember to match their energy/vibe. Also remeber to refer to them as there name. Make sure to to always complete your scentence, and make sure to use slang in your responses! If someone ever tells you they want to harm themself or others, tell them to call the suicide hotline number at 988.: {top_results}"}]
|
| 131 |
print(messages)
|
| 132 |
if history:
|