File size: 1,134 Bytes
5f3ed4e
fb8429f
5f3ed4e
 
 
 
 
 
 
beb78e7
5f3ed4e
 
dba720b
5f3ed4e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
beb78e7
4a18162
5f3ed4e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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()