model error in web service using Flask
See original GitHub issueCheck List
- I have searched in existing issues but did not find the same one.
- I have read the documents
Environment
- OS [Linux ubuntu 16.04]:
Issue Description
What
When I deploy kashgari.tasks.classification model on the web service using Flask, I encounter an error showing below: tensorflow.python.framework.errors_impl.InvalidArgumentError: Tensor Input-Token:0, specified in either feed_devices or fetch_devices was not found in the Graph
and source code:
@app.route('/api/deep_classify/multi', methods=['GET', 'POST'])
def deep_classify_all():
text = unquote(request.values.get("text"))
categories = kashgari.tasks.classification.BiGRU_Model.predict_top_k_class([segment(text)])
return categories
Other Comment
After research a while, I think the reason may be this: []https://kobkrit.com/tensor-something-is-not-an-element-of-this-graph-error-in-keras-on-flask-web-server-4173a8fe15e1
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Handling Application Errors — Flask Documentation (2.2.x)
When Flask catches an exception while handling a request, it is first looked up by code. If no handler is registered for the...
Read more >How To Handle Errors in a Flask Application - DigitalOcean
In this tutorial, you'll build a small web application that demonstrates how to handle common errors one encounters when developing a web ......
Read more >Can't connect to Flask web service, connection refused
In order to get access from your laptop open up the terminal on your raspi and try instead the ip from ifconfig should...
Read more >Flask API Error Handling. Build and Deploy a ... - YouTube
Flask API Error Handling. Build and Deploy a Python Flask REST API with JWT #18Source code.https://github.com/CryceTruly/bookmarker-apiFull ...
Read more >How To Fix an Internal Server Error in Flask - YouTube
In this beginner level video I explain what steps you need to take when you get an Internal Server Error in your Flask...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I also encountered this error using flask. The way that solved this problem in my case is keeping the graph & session to be the same for loading the model and doing the prediction, like this:
It can’t possibly be the best way. But it works for me. @alexwwang 's point sounds quite convincing, I think that’s why specifying the graph & session helps.