def chat_with_model(): | |
print("Welcome to the Question Answering Chatbot! (type 'exit' to quit)") | |
while True: | |
question = input("You: ") | |
if question.lower() == 'exit': | |
print("Goodbye!") | |
break | |
context = input("Context: ") | |
if context.lower() == 'exit': | |
print("Goodbye!") | |
break | |
response = question_answerer(question=question, context=context) | |
answer = response['answer'] | |
score = response['score'] | |
print(f"Bot: {answer} (confidence: {score:.2f})") | |
if __name__ == "__main__": | |
chat_with_model() |