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

post返回的结果:404,是什么原因呢 #2

Open
PingYufeng opened this issue Feb 21, 2020 · 3 comments
Open

post返回的结果:404,是什么原因呢 #2

PingYufeng opened this issue Feb 21, 2020 · 3 comments

Comments

@PingYufeng
Copy link

flask_server:
Loading PyTorch model and Flask starting server ...
Please wait until server has fully started

  • Serving Flask app "run_pytorch_server" (lazy loading)
  • Environment: production
    WARNING: This is a development server. Do not use it in a production deployment.
    Use a production WSGI server instead.
  • Debug mode: off
  • Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
    127.0.0.1 - - [21/Feb/2020 16:47:21] "?[33mPOST /predict/ HTTP/1.1?[0m" 404 -

client:
打印post返回的结果
<Response [404]>
Traceback (most recent call last):
File "e:/RiseFile/Deeplearning/Deploy/myModleDeploy/Flask/examples/deploy-pytorch-model/simple_request.py", line 40, in
predict_result(args.file)
File "e:/RiseFile/Deeplearning/Deploy/myModleDeploy/Flask/examples/deploy-pytorch-model/simple_request.py", line 22, in predict_result
r = r.json()
File "D:\Anaconda3\envs\py36\lib\site-packages\requests\models.py", line 898, in json
return complexjson.loads(self.text, **kwargs)
File "D:\Anaconda3\envs\py36\lib\json_init_.py", line 354, in loads
return _default_decoder.decode(s)
File "D:\Anaconda3\envs\py36\lib\json\decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "D:\Anaconda3\envs\py36\lib\json\decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

@Salary-only-17k
Copy link

同样问题

@HamzaManzoor66
Copy link

In run_pytorch_server file, at around line 89, try converting the label to float before passing it idx2label.
label_name = idx2label[float(label)]
like this, this solved it for me.

@WangYichenCode
Copy link

yes, this solved it also for me. thanks!

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

4 participants