Spaces:
Running
Running
Upload app.py
Browse files
app.py
CHANGED
@@ -88,7 +88,7 @@ def get_dynamic_context_semantic(question, knowledge_base, knowledge_base_embedd
|
|
88 |
# Check expanded QA dataset first for a direct answer
|
89 |
def get_answer_from_expanded_qa(question, expanded_qa_dataset):
|
90 |
for item in expanded_qa_dataset:
|
91 |
-
if item['question'].lower()
|
92 |
return item['answer']
|
93 |
return None
|
94 |
|
@@ -100,7 +100,7 @@ def answer_question(question):
|
|
100 |
return direct_answer
|
101 |
|
102 |
# If no direct answer found, use the knowledge base with semantic search
|
103 |
-
context = get_dynamic_context_semantic(question, knowledge_base, knowledge_base_embeddings)
|
104 |
return context
|
105 |
|
106 |
# Gradio interface setup
|
|
|
88 |
# Check expanded QA dataset first for a direct answer
|
89 |
def get_answer_from_expanded_qa(question, expanded_qa_dataset):
|
90 |
for item in expanded_qa_dataset:
|
91 |
+
if item['question'].lower() == question.lower():
|
92 |
return item['answer']
|
93 |
return None
|
94 |
|
|
|
100 |
return direct_answer
|
101 |
|
102 |
# If no direct answer found, use the knowledge base with semantic search
|
103 |
+
context = get_dynamic_context_semantic(question, knowledge_base, knowledge_base_embeddings, threshold=0.55)
|
104 |
return context
|
105 |
|
106 |
# Gradio interface setup
|