Views
No views yet
deepset/roberta-base-squad2 for question answering tasks.pipeline API:1from transformers import pipeline
2
3# Load the model
4qa_pipeline = pipeline(
5 "question-answering",
6 model="takumi123xxx/qa-model-hello-world"
7)
8
9# Use the model
10context = "Tokyo is the capital city of Japan. Tokyo was originally a fishing village named Edo."
11question = "What was Tokyo originally called?"
12
13result = qa_pipeline(question=question, context=context)
14print(f"Answer: {result['answer']}")
15print(f"Score: {result['score']}")1from huggingface_hub import InferenceClient
2
3client = InferenceClient()
4result = client.question_answering(
5 question="What was Tokyo originally called?",
6 context="Tokyo is the capital city of Japan. Tokyo was originally a fishing village named Edo.",
7 model="takumi123xxx/qa-model-hello-world"
8)