Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -44,10 +44,10 @@ with gr.Blocks() as demo:
|
|
44 |
bot_message = "Hm, I don't see any document text, please paste in the box on the left."
|
45 |
else:
|
46 |
query_bot = query_model({"inputs": {"question": message, "context": context}})
|
47 |
-
if(len(query_bot) and ("answer" in query_bot)):
|
48 |
bot_message = query_bot['answer']
|
49 |
else:
|
50 |
-
bot_message = "I'm having trouble with this question, please try rewording
|
51 |
|
52 |
|
53 |
chat_history.append((message, bot_message))
|
|
|
44 |
bot_message = "Hm, I don't see any document text, please paste in the box on the left."
|
45 |
else:
|
46 |
query_bot = query_model({"inputs": {"question": message, "context": context}})
|
47 |
+
if(len(query_bot) and ("answer" in query_bot)) and (query_bot['score'] > 0.1):
|
48 |
bot_message = query_bot['answer']
|
49 |
else:
|
50 |
+
bot_message = random.choice(["I'm having trouble with this question, please try rewording and make sure it is relevant to the document.", "Hm, I'm having trouble finding the answer to that. Can you reword the question?", "Sorry, I can't find the answer to this question."])
|
51 |
|
52 |
|
53 |
chat_history.append((message, bot_message))
|