Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -39,6 +39,7 @@ class CompanyKnowledgeBase:
|
|
| 39 |
|
| 40 |
def find_answer(self, query, threshold=0.8):
|
| 41 |
if not self.dataset:
|
|
|
|
| 42 |
return None
|
| 43 |
|
| 44 |
try:
|
|
@@ -52,6 +53,7 @@ class CompanyKnowledgeBase:
|
|
| 52 |
if D[0][0] < threshold:
|
| 53 |
# Find the matched question
|
| 54 |
matched_question = list(self.question_to_answer.keys())[I[0][0]]
|
|
|
|
| 55 |
return self.question_to_answer[matched_question]
|
| 56 |
|
| 57 |
except Exception as e:
|
|
|
|
| 39 |
|
| 40 |
def find_answer(self, query, threshold=0.8):
|
| 41 |
if not self.dataset:
|
| 42 |
+
print('Context not found in the dataset.')
|
| 43 |
return None
|
| 44 |
|
| 45 |
try:
|
|
|
|
| 53 |
if D[0][0] < threshold:
|
| 54 |
# Find the matched question
|
| 55 |
matched_question = list(self.question_to_answer.keys())[I[0][0]]
|
| 56 |
+
print('Found matched:' + matched_question)
|
| 57 |
return self.question_to_answer[matched_question]
|
| 58 |
|
| 59 |
except Exception as e:
|