You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tika.apache.org by "Paul Bustios (JIRA)" <ji...@apache.org> on 2017/03/23 03:08:41 UTC

[jira] [Created] (TIKA-2308) RESTful service for image recognition fails in Python 3.x

Paul Bustios created TIKA-2308:
----------------------------------

             Summary: RESTful service for image recognition fails in Python 3.x
                 Key: TIKA-2308
                 URL: https://issues.apache.org/jira/browse/TIKA-2308
             Project: Tika
          Issue Type: Bug
          Components: parser
            Reporter: Paul Bustios
            Priority: Minor


The /inception/v3/classify resource fails to classify an image in Python 3.x because json fails to serialize class ids, which are numbers of type numpy.int64. More information about the issue can be found in https://bugs.python.org/issue24313.

[2017-03-23 00:05:04,793] ERROR in app: Exception on /inception/v3/classify [GET]
Traceback (most recent call last):
  File "/home/paul/miniconda3/lib/python3.5/site-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/paul/miniconda3/lib/python3.5/site-packages/flask/app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/paul/miniconda3/lib/python3.5/site-packages/flask/app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/paul/miniconda3/lib/python3.5/site-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/home/paul/miniconda3/lib/python3.5/site-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/paul/miniconda3/lib/python3.5/site-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "tika-parsers/src/main/resources/org/apache/tika/parser/recognition/tf/inceptionapi.py", line 317, in classify_image
    return Response(response=json.dumps(res),
  File "/home/paul/miniconda3/lib/python3.5/json/__init__.py", line 230, in dumps
    return _default_encoder.encode(obj)
  File "/home/paul/miniconda3/lib/python3.5/json/encoder.py", line 198, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/home/paul/miniconda3/lib/python3.5/json/encoder.py", line 256, in iterencode
    return _iterencode(o, 0)
  File "/home/paul/miniconda3/lib/python3.5/json/encoder.py", line 179, in default
    raise TypeError(repr(o) + " is not JSON serializable")
TypeError: 211 is not JSON serializable
127.0.0.1 - - [23/Mar/2017 00:05:04] "GET /inception/v3/classify?topk=2&url=https://upload.wikimedia.org/wikipedia/commons/f/f6/Working_Dogs%2C_Handlers_Share_Special_Bond_DVIDS124942.jpg HTTP/1.1" 500 -



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)