Links
Comment on page

Using PIP Python Package

iApp Technology just released a PIP Python Package on Thai Question Answering (ThaiQA).
For easing the python development using iApp AI API service, we have released the iapp_ai python pip package. It is the api client library for iApp AI API service for python.

Installation

$ pip install iapp_ai
Note: It can be either pip or pip3 depend on your environment.

Calling ThaiQA API

# ThaiQA API required Question and Document (short paragraph)
quest = "แค็วม์เป็นแค่หมู่บ้านใช่หรือไม่"
docs = "จังหวัดแค็วม์โปแลนด์คือหน่วยการปกครองท้องถิ่นของประเทศโปแลนด์ในช่วงปี ค.ศ.1975 - ค.ศ.1998 จังหวัดได้รับการรวมเข้ากับจังหวัดลูบลินมีเมืองหลักคือแค็วม์ใน ปี ค.ศ.1998 มีพื้นที่ประมาณ 3865 ตารางกิโลเมตรและมีประชากร 248800 คน"
api.thai_qa_api(question= quest, document=docs).text

Example Usages

import iapp_ai
# You can request API key at https://ai.iapp.co.th
apikey = 'XXXXX_Your_API_Key_XXXXX'
api = iapp_ai.api(apikey)
# ThaiQA API required Question and Document (short paragraph)
result = api.thai_qa_api(question= quest, document=docs).text
print(result)
# ไม่ใช่

Full Example in Google Colaboratory

Google Colaboratory
Full Example of iApp AI API in Google Colaboratory