sep / app.py
razanalsulami's picture
Rename app to app.py
cce9065 verified
raw
history blame
953 Bytes
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']}")