made adjustments to cleaned_chunks so it would result in the knowledge base being preprocessed; adjusted location of top_results code inside respond function
Browse files
app.py
CHANGED
|
@@ -20,6 +20,8 @@ def preprocess_text(text):
|
|
| 20 |
cleaned_chunks.append(strip_chunk)
|
| 21 |
|
| 22 |
return cleaned_chunks
|
|
|
|
|
|
|
| 23 |
|
| 24 |
model = SentenceTransformer('all-MiniLM-L6-v2')
|
| 25 |
|
|
@@ -53,11 +55,9 @@ def get_top_chunks (query, chunk_embeddings, cleaned_chunks):
|
|
| 53 |
|
| 54 |
return top_chunks
|
| 55 |
|
| 56 |
-
top_results = get_top_chunks("How does an Aquarius show up in their family?", chunk_embeddings, cleaned_chunks)
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
def respond(message, history):
|
|
|
|
|
|
|
| 61 |
|
| 62 |
messages = [{"role": "system", "content": "You are a clairvoyant chatbot with vast knowledge on zodiac signs, but you also give the information very clearly so users can understand the message you're conveying."}]
|
| 63 |
|
|
|
|
| 20 |
cleaned_chunks.append(strip_chunk)
|
| 21 |
|
| 22 |
return cleaned_chunks
|
| 23 |
+
|
| 24 |
+
cleaned_chunks = preprocess_text(knowledgebase_text)
|
| 25 |
|
| 26 |
model = SentenceTransformer('all-MiniLM-L6-v2')
|
| 27 |
|
|
|
|
| 55 |
|
| 56 |
return top_chunks
|
| 57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
def respond(message, history):
|
| 59 |
+
|
| 60 |
+
top_results = get_top_chunks(message, chunk_embeddings, cleaned_chunks)
|
| 61 |
|
| 62 |
messages = [{"role": "system", "content": "You are a clairvoyant chatbot with vast knowledge on zodiac signs, but you also give the information very clearly so users can understand the message you're conveying."}]
|
| 63 |
|