I am new to Vision API product search. I have a requirement wherein I have to read create-productIds.csv and delete-productIds.csv each of which contains a list of reference images and make http request to Vision API product search to create / delete products. As I understand there are various ways (python / Google Cloud Vision Operators) to do the same. I am sorry I have no code to showcase as I am completely new to Vision API.
create-productIds.csv contains references images as below:
gs://productimages/p_1001202389.jpg,p_1001202389,product_set_1,1001202389,general-v1,Flush Mount Assembled Oak Dark Stain Right Hand In-Swing Interior Door,,
gs://productimages/p_1001202396.jpg,p_1001202396,product_set_1,1001202396,general-v1,Flush Mount Assembled Hickory Unfinished Left Hand Out-Swing Interior Bookcase Door,,
gs://productimages/p_1001202398.jpg,p_1001202398,product_set_1,1001202398,general-v1,Flush Mount Assembled Hickory Unfinished Right Hand Out-Swing Interior Bookcase Door,,
gs://productimages/p_1001202392.jpg,p_1001202392,product_set_1,1001202392,general-v1,Flush Mount Assembled Oak Cherry Stain Left Hand Out-Swing Interior Bookcase Door,,
there many be 100's or even 1000's of reference images
I read the documentation and it states that:
Requests are POST requests to https://vision.googleapis.com/v1/images:annotate
Request format is:
{
"requests":[
{
"image":{
"content":"/9j/7QBEUGhvdG9...image contents...eYxxxzj/Coa6Bax//Z"
},
"features":[
{
"type":"LABEL_DETECTION",
"maxResults":1
}
]
}
]
}
I also read https://cloud.google.com/vision/product-search/docs/create-product-set-search-products
here it states that dataset can be given as
{
"inputConfig": {
"gcsSource": {
"csvFileUri": "gs://cloud-samples-data/vision/product_search/product_catalog.csv"
}
}
}
then a request is sent through curl command
curl -X POST \
-H "Authorization: Bearer "$(gcloud auth print-access-token) \
-H "Content-Type: application/json; charset=utf-8" \
-d @import_request.json \
https://vision.googleapis.com/v1/projects/$PROJECT_ID/locations/$LOCATION_ID/productSets:import
so either I use python / Google Cloud Vision Operators preference is Google Cloud Vision Operators
could I use CloudVisionCreateProductOperator as below:
product_create = CloudVisionCreateProductOperator(
location=LOCATION,
product=product,
retry=Retry(maximum=10.0),
timeout=5,
task_id="product_create",
)
product = Product(display_name="My Product 1", product_category="toys")
But this would be for one product. I have multiple products and where is http requests endpoint is being given and other details from the reference image.