Closed scho0ck closed 2 years ago
@scho0ck you have make sure all the requests process one by one. Can you please try the solution (threading.Semaphore()) provided here: https://stackoverflow.com/questions/42325105/flask-processing-requests-1-by-1
@hjonnala Thanks a lot this solved my issue.
@hjonnala @scho0ck It solved my issue as well, in django. Thanks!!!
Description
Getting the following error on my python flask app that exposes the interpreter on a web based service.
_ensure_safe data access.""") RuntimeError: There is at least 1 reference to internal data in the interpreter in the form of a numpy array or slice. Be sure to only hold the function returned from tensor() if you are using raw data access.
This issue occurs when I'm sending images from multiple source interestingly enough the predictions are still valid however the error is raised and I have no idea how to solve it.
I'm running the following code:
Click to expand!
### Issue Type Support ### Operating System Linux ### Coral Device USB Accelerator ### Other Devices Rapsberry Pi 4 ### Programming Language Python 3.6 ### Relevant Log Output ```shell Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 2091, in __call__ return self.wsgi_app(environ, start_response) File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 2076, in wsgi_app response = self.handle_exception(e) File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 2073, in wsgi_app response = self.full_dispatch_request() File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1518, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1516, in full_dispatch_request rv = self.dispatch_request() File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1502, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args) File "/app/coral-app.py", line 52, in predict interpreter.invoke() File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 832, in invoke self._ensure_safe() File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 436, in _ensure_safe data access.""") RuntimeError: There is at least 1 reference to internal data in the interpreter in the form of a numpy array or slice. Be sure to only hold the function returned from tensor() if you are using raw data access. ```