When using ultralytics/yolov5, the following error occurred.
As mentioned in the following issue, this appears to be caused by an API change.
https://github.com/robmarkcole/yolov5-flask/issues/23
As one example, the error was resolved by rewriting the program as follows.
I hope this is helpful for those experiencing the same issue.