Update app.py
Browse files
app.py
CHANGED
@@ -46,12 +46,12 @@ async def answer_question(request: AnswerQuestionRequest):
|
|
46 |
query_embeddings = model.encode(request.question, convert_to_tensor=True)
|
47 |
hits = util.semantic_search(query_embeddings, corpus_embeddings)
|
48 |
for hit in hits[0]:
|
49 |
-
if hit['score'] > .
|
50 |
loc = hit['corpus_id']
|
51 |
res_locs.append(request.locations[loc])
|
52 |
context_string += request.context[loc] + ' '
|
53 |
if len(res_locs) == 0:
|
54 |
-
ans = "Sorry, I couldn't find any results for your query."
|
55 |
else:
|
56 |
QA_input = {
|
57 |
'question': request.question,
|
|
|
46 |
query_embeddings = model.encode(request.question, convert_to_tensor=True)
|
47 |
hits = util.semantic_search(query_embeddings, corpus_embeddings)
|
48 |
for hit in hits[0]:
|
49 |
+
if hit['score'] > .4:
|
50 |
loc = hit['corpus_id']
|
51 |
res_locs.append(request.locations[loc])
|
52 |
context_string += request.context[loc] + ' '
|
53 |
if len(res_locs) == 0:
|
54 |
+
ans = "Sorry, I couldn't find any results for your query. Please try again!"
|
55 |
else:
|
56 |
QA_input = {
|
57 |
'question': request.question,
|