Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

my model can be loaded but when I send request to do the predict I got some errors #90

Open
Foina opened this issue Jun 19, 2021 · 2 comments

Comments

@Foina
Copy link

Foina commented Jun 19, 2021

The error I got:
File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.8/site-packages/flask_cors/extension.py", line 165, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functionsrule.endpoint
File "/usr/local/lib/python3.8/site-packages/simple_tensorflow_serving/server.py", line 380, in decorated
return f(*decorator_args, **decorator_kwargs)
File "/usr/local/lib/python3.8/site-packages/simple_tensorflow_serving/server.py", line 180, in inference
response = jsonify(json_result)
File "/usr/local/lib/python3.8/site-packages/flask/json/init.py", line 370, in jsonify
dumps(data, indent=indent, separators=separators) + "\n",
File "/usr/local/lib/python3.8/site-packages/flask/json/init.py", line 211, in dumps
rv = _json.dumps(obj, **kwargs)
File "/usr/local/Cellar/[email protected]/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/init.py", line 234, in dumps
return cls(
File "/usr/local/Cellar/[email protected]/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/local/Cellar/[email protected]/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "/usr/local/lib/python3.8/site-packages/flask/json/init.py", line 100, in default
return _json.JSONEncoder.default(self, o)
File "/usr/local/Cellar/[email protected]/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/encoder.py", line 179, in default
raise TypeError(f'Object of type {o.class.name} '
TypeError: Object of type bytes is not JSON serializable

The request:
{
"model_name": "default",
"model_version": 1,
"data": {
"inputs":["","",""]
}
}

I feel have difficulties to find the correct data structure, may I get some help from you?

@tobegit3hub
Copy link
Owner

It may be the issue of JSON serialization. Can you check the request data which might be string in correct format.

@Foina
Copy link
Author

Foina commented Jun 21, 2021

It may be the issue of JSON serialization. Can you check the request data which might be string in correct format.

Thank you for your reply. I have difficulties to figure out what should the requested data be

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants