Microservice API returning empty prediction?

I’d like to host an API that can predict classifications. I’ve got the bear classification example hosted on render working.

In theory I should just POST requests to /analyze and I will receive a JSON of {‘result’: str(prediction)}. See @app.route(’/analyze’, methods=[‘POST’]).

Unfortunately, when I make the simulate makine the call remotely (from 127.0.0.1:3000 to /analyse on 127.0.0.1:5402), the returned responseText is empty. Does anyone know why? It should have the prediction…

image

This is the analyse function I run from 127.0.0.1:3000. It is taken from here in the render example mentioned above. However I’ve modified the code so it doesn’t look for an image the user has uploaded to the page, and instead fetches “https://upload.wikimedia.org/wikipedia/commons/7/77/Delete_key1.jpg”. Ultimately I want to replace this with whatever image I submit via the API call, but I need to fix the empty responseText I’m getting first. Any ideas please?

1 Like