to be described here
If you want to use pdf processing functionality, follow this instructions to install popppler on your machine. On Windows, if the poppler "bin" path is not added to PATH, you have to set the environment variable POPPLER_PATH to point to bin.
Create the client first:
import perceptor_client_lib.perceptor as perceptor
API_KEY = "your_api_key"
perceptor_client = perceptor.Client(api_key=API_KEY)
optionally, another url can be specified:
perceptor_client = perceptor.Client(api_key="your_key",request_url="another_url")
result = perceptor_client.ask_text("text_to_process",
instructions=[
"Question 1?",
"Question 2",
])
Following image formats are supported: "jpg", "png".
From image file:
result = perceptor_client.ask_image("path_to_image_file",
instructions=[
"Question 1?",
"Question 2",
])
or from image file:
reader = open("image_path", 'rb')
with reader:
result = perceptor_client.ask_image(reader,
instructions=[
"Question 1?",
"Question 2",
], file_type='jpg')
or from bytes:
reader = open(_image_path, 'rb')
with reader:
content_bytes = reader.read()
result = perceptor_client.ask_image(content_bytes,
instructions=[
"Question 1?",
"Question 2",
], file_type='jpg')
Table queries can be performed as following:
result = perceptor_client.ask_table_from_image("path_to_image_file",
instruction="GENERATE TABLE Column1, Column2, Column3 GUIDED BY Column3",
)
From document file:
result = perceptor_client.ask_document("path_to_document_file",
instructions=[
"Question 1?",
"Question 2",
])