Spaces:
Running
Running
File size: 665 Bytes
b193f73 752919d b193f73 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import pandas as pd
import model
def chatbot(question):
# Provide a context or passage where the answer can be found
with open(r"Data.txt", "r", encoding="utf-8") as file:
context = file.read()
# Use the question-answering model to find the answer
answer = model.qa_pipeline(question=question, context=context)
return answer
def prints(questions):
response = chatbot(questions)
# print(f"Question: {question}")
# print(f"Answer: {response['answer']}")
# print(f"Confidence: {response['score']:.4f}")
# print()
return response['answer']
# result = prints(stream.query)
# print(result)
# stream.receive_data(result) |