Skip to content

Commit

Permalink
try to parse non form input
Browse files Browse the repository at this point in the history
  • Loading branch information
Ubuntu committed Oct 14, 2019
1 parent 5c88e48 commit 56f78f4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
14 changes: 10 additions & 4 deletions cufacesearch/cufacesearch/api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,16 @@ def put_post(self, mode):
:rtype: dict
"""
pid = os.getpid()
print("[put/post.{}] received parameters: {}".format(pid, request.form.keys()))
form = request.form
print("[put/post.{}] received parameters: {}".format(pid, form.keys()))
if 'data' not in request.form.keys():
print("[put/post.{}] trying to parse input".format(pid))
form = json.loads(request.form.keys()[0])
print("[put/post.{}] received parameters: {}".format(pid, form.keys()))
print("[put/post.{}] received request: {}".format(pid, request))
query = request.form['data']
query = form['data']
try:
options = request.form['options']
options = form['options']
except:
options = None
print("[put/post.{}] received data of length: {}".format(pid, len(query)))
Expand Down Expand Up @@ -290,6 +295,7 @@ def search_byB64(self, query, options=None):
:rtype: dict
"""
query_b64s = [str(x) for x in query.split(',') if not x.startswith('data:')]
print("Received {} B64 queries with length of: {}".format(len(query_b64s), [len(x) for x in query_b64s]))
options_dict, errors = self.get_options_dict(options)
outp = self.searcher.search_imageB64_list(query_b64s, options_dict)
outp_we = self.append_errors(outp, errors)
Expand Down Expand Up @@ -546,4 +552,4 @@ def view_image_sha1(self, query, options=None):
images = Markup(images_str)
flash(images)
headers = {'Content-Type': 'text/html'}
return make_response(render_template('view_images.html'),200,headers)
return make_response(render_template('view_images.html'),200,headers)
3 changes: 3 additions & 0 deletions cufacesearch/cufacesearch/searcher/searcher_lopqhbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,9 @@ def search_from_feats(self, dets, feats, options_dict=dict()):
sim_images = []
sim_score = []

msg = "[{}.search_from_feats: log] Searching from {} full image features"
print(msg.format(self.pp, len(feats)))

for i in range(len(feats)):
if self.searcher:
# Normalize feature first as it is how it is done during extraction...
Expand Down

0 comments on commit 56f78f4

Please sign in to comment.