Spaces:
Runtime error
Runtime error
File size: 953 Bytes
cfb36d4 1901b68 cfb36d4 1901b68 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
from transformers import pipeline
qa_pipeline = pipeline("question-answering")
context = """Saudi Arabia, officially known as the Kingdom of Saudi Arabia, is the largest country in the Middle East.
It is bordered by Jordan, Iraq, Kuwait, Bahrain, Qatar, the United Arab Emirates, Oman, and Yemen.
The capital city is Riyadh. Saudi Arabia is known for its vast deserts, including the Rub’ al Khali, also
known as the Empty Quarter, which is the largest continuous sand desert in the world. The country is also famous
for being the birthplace of Islam and home to its two holiest cities, Mecca and Medina. Saudi Arabia's economy is
heavily dependent on oil, making it one of the world’s leading oil producers and exporters. The official language
is Arabic, and the currency is the Saudi riyal."""
question = "What is the capital of Saudi Arabia?"
answer = qa_pipeline(question=question, context=context)
print(f"Answer: {answer['answer']}")
|