====== upload_image ======
Host: **warp.picalike.corpex-kunden.de**
Port: **8080**
===== Dependencies =====
* werkzeug
* extractor
* featuredb
* filehandler
===== Configuration =====
**config_json** contains information used by **upload** to handle requests and responses.
**fh_config.json** contains information used by **filehandler** to store and retrieve files. Files are uploaded as ''%%path/dir/file_name%%''.
* ''%%file_name%%'' is made up of ''%%file_id%%'' and ''%%file_ext%%''
* ''%%file_id%%'' is the hexadecimal sha256 digest of the uploaded file
* ''%%file_ext%%'' depends on the mimetype of the file
* ''%%dir%%'' is given by the last ''%%'hash_len%%''' characters of ''%%file_id%%''
* ''%%path%%'' is contained in ''%%'uploaded_path%%'''
===== APIs =====
==== /categories ====
Returns features and topk most relevant categories.
in:
out:
{"error": , "categories": , "labels": , "color": , "uploadId": }
=== Details ===
Image is submitted through a form and saved by FileHandler that returns ''%%file_name%%''. ''%%uploadId%%'' is the file URL, i.e., ''%%current url + image/ + file_name%%''. This URL is used by ''%%get_features()%%'' to extract the features from the image and by ''%%ImageCategory.get_category()%%'' to obtain the ''%%topk%%'' most relevant categories. The response is packed into ''%%CONFIG['cresp_json']%%''.
==== /similarity ====
Returns n_results most similar products in category.
in:
{"uploadId": , "category": , "n_results": }
out:
{"error": , "category": , "similar_products": }
=== Details ===
Data is submitted through ''%%sim_req.json%%''. ''%%uploadId%%'' is the file URL. This is used by ''%%get_features()%%'' to retrieve the features from the DB. ''%%category%%'' is mapped to a list of customer categories by ''%%FixedMapper.get_customer_category()%%''. This list, together with the features, is used by ''%%get_similar_products()%%'' to obtain the ''%%n_results%%'' most similar products. The response is packed into ''%%CONFIG['sresp_json']%%''.
The available categories are the keys contained in ''%%/home/picalike-dev/v4_etc/cat_map.json%%'', currently: [“ballerinas”, “sneaker”, “sandals-heel”, “shopper”, “shoulder-bag”, “slip-pack”, “socks”, “swimsuite”, “dress”, “belt”, “blouse”, “boots-high”, “handbags”, “skirt”, “backpack”, “hat”, “pants”, “messenger-bag”, “watch”, “pumps”, “boots”, “sandals”, “beanie”, “blazer”, “ankle-boots”, “bag-bag”, “coat”, “bracelet”, “business-shoes”, “bikini”, “clutch”, “wedges”, “scarf”, “glasses”]
==== /image/ ====
Returns image.
=== Details ===
Reconstructs the path corresponding to http:%%//%%warp.picalike.corpex-kunden.de:8080/image/ and returns its content as an image.