Let's get you up and running with state-of-the-art AI.
The SmartLens Python library provides convenient access to the SmartLens API from applications written in the Python language. Integrate state-of-the-art AI into your application in just a few lines of code. To get started, run the following command from your terminal:
Bash
$ pip install smartlens
With the SmartLens Python library, you only need to specify your API key once -- upon initialization.
Python
import smartlens
smartlens.api_key = "MY_API_KEY"
Every individual service has a unique endpoint and schema, and every API handles exactly one input per request. The SmartLens Image Tagging and Image Captioning APIs accept JPEG
and
PNG
files as inputs, either as a file encoded in base64 or as a URL.
SmartLens Document AI accepts PDF
, JPEG
, and
PNG
files as inputs, either as a file encoded in base64 or as a URL.
With the SmartLens Python libary -- unlike calling the SmartLens API with cURL -- you also have the option of specifying a path to your file. We've included some examples below.
Python
import smartlens
smartlens.api_key = "MY_API_KEY"
# tag image
tags = smartlens.tagImage(
image = "MY-IMAGE (can be JPEG or PNG, submitted as a web URL, a path to a file, or as bytes encoded in base64)"
)
# caption image
captions = smartlens.captionImage(
image = "MY-IMAGE (can be JPEG or PNG, submitted as a web URL, a path to a file, or as bytes encoded in base64)"
)
# process document
extractedItems = smartlens.runDocumentAI(
document = "MY-DOCUMENT (can be PDF, JPEG or PNG, submitted as a web URL, a path to a file, or as bytes encoded in base64)",
customExtractions = [{'natural_language_query': 'What is the salary?', 'answer_key': 'employee_salary'}] # Custom extractions are optional
)
# process text document
extractedItems = smartlens.runTextAnalysis(
text = "MY-TEXT",
customExtractions = [{'natural_language_query': 'What is the salary?', 'answer_key': 'employee_salary'}] # Custom extractions are optional
)
Please refer to the sidebar menu for API-specific quickstarts and detailed schema information. If you have any questions or feedback, please reach out to us at [email protected]
.