Skip to content
This repository has been archived by the owner on Nov 8, 2021. It is now read-only.

Add type bytes, then You can read image file by yourself. #62

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cognitive_face/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ def parse_image(image):
headers = {'Content-Type': 'application/octet-stream'}
data = open(image, 'rb').read()
return headers, data, None
elif type(image) == bytes: # You can read image file by yourself.
LuxunHuang marked this conversation as resolved.
Show resolved Hide resolved
headers = {'Content-Type': 'application/octet-stream'}
data = image
return headers, data, None
else: # Default treat it as a URL (string).
headers = {'Content-Type': 'application/json'}
json = {'url': image}
Expand Down