Table of Contents
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 offile_id
andfile_ext
file_id
is the hexadecimal sha256 digest of the uploaded filefile_ext
depends on the mimetype of the filedir
is given by the last'hash_len
' characters offile_id
path
is contained in'uploaded_path
'
APIs
/categories
Returns features and topk most relevant categories.
in:
<form action="/categories" method="POST" enctype="multipart/form-data"> <input type="file" name="myfile"> </form>
out:
{"error": <str>, "categories": <list>, "labels": <list>, "color": <list>, "uploadId": <str>}
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": <str>, "category": <str>, "n_results": <str>}
out:
{"error": <str>, "category": <str>, "similar_products": <list>}
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/<file_name>
Returns image.
Details
Reconstructs the path corresponding to http://warp.picalike.corpex-kunden.de:8080/image/<file_name> and returns its content as an image.