Views
No views yet
1from transformers import pipeline
2
3# Load the question-answering pipeline
4qa_pipeline = pipeline("question-answering", model="username/myqa") # Replace with your model path
5
6# Example document
7context = """Your text document content here."""
8question = "What is the main topic of the document?"
9
10# Generate answer
11result = qa_pipeline(question=question, context=context)
12
13# Print the answer
14print(result['answer'])