This python client is a simple wrapper around our powerful Visual Discovery API.
The wrapper allows you to create your own index of images on which you would like to enhance the product discovery experiences. It also allows you to get various types of recommendations which are listed below.
- Visual Recommendation
- Cross Product Recommendation
- Personalized Recommendation
To install the package you can follow the steps:-
[sudo] pip install artifacia
The API is really easy and simple to use. First you need to visit this page and request for username and password. Using that credentials you can create your constructor and get stated.
from artifacia import artifacia
api_key = <your_api_key>
client = artifacia.Client(api_key)
The first step is to create a index of the items that you would like to store in our databases to perform search against. If you don't have data ready right now you can quickly get started with our sample data. Once the data is stored and indexed we will inform you shortly.
import json
sample_data = json.load(open("sample_data.json","rb"))
data_indexing_response = client.upload_item_data(sample_data)
print data_indexing_response
Once you receive a notification from us about the status of the indexed data, you are ready to search. You can search for a product ID indexed in the sample data you inserted/uploaded. And also specify the number of results you want to be returned as well as attributes if want to proritize the result below is the example which you can refer.
sample_prod_id = 2761
num = 4
filters = {"color":1, "pattern":1}
query_response = client.get_visual_recommendation(sample_prod_id, num, filters)
print query_response