Heraali commited on
Commit
c63d78d
1 Parent(s): d918aeb

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
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() in 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