Spaces:
Runtime error
Runtime error
| from transformers import pipeline | |
| # Predefined context | |
| context = """ | |
| The Scrum framework consists of Scrum Teams and their roles, events, and artifacts. | |
| Scrum Teams are self-managing and cross-functional. The main roles include the Scrum Master, | |
| Product Owner, and Development Team. The Daily Stand-up is a short meeting for the Scrum Team | |
| to synchronize activities and create a plan for the next 24 hours. | |
| """ | |
| # Load the question-answering model | |
| question_answerer = pipeline("question-answering", model='distilbert-base-cased-distilled-squad') | |
| def answer_question(question): | |
| """Answer the question based on the predefined context.""" | |
| result = question_answerer(question=question, context=context) | |
| return result['answer'] | |
| def main(): | |
| print("Welcome to the Simple Q&A Agent!") | |
| print("Type 'exit' to quit.\n") | |
| while True: | |
| user_input = input("Ask a question: ") | |
| if user_input.lower() == 'exit': | |
| print("Goodbye!") | |
| break | |
| answer = answer_question(user_input) | |
| print(f"Answer: {answer}\n") | |
| if __name__ == "__main__": | |
| main() |