Web App Error after shutting down Jupyter

Hey there,

What I’m trying to do:
I’m trying to publish a web app for Machine Learning Model by connecting anvil with jupyter notebook which will work after closing my jupyter notebook.

What I did:
I’ve created the uplink server connection, when my notebook is open it works, as soon as I close it an error occurs.

I really don’t know what to do, in every tutorial it just works :frowning:

Here’s a part of my python code:

anvil.server.connect(“myserver”)

@anvil.server.callable
def predict_success(data):
new_data = pd.DataFrame(data, index=[0])
new_data_encoded = encoder.transform(new_data).toarray()
prediction = model.predict_proba(new_data_encoded)[:, 1]
return prediction[0]

And the part in my anvil code:
predict_success = anvil.server.call(‘predict_success’, data)

Can someone help me, please?

Thanks A LOT in advance!

Have you added anvil.server.wait_forever() to your code?

If not, try adding it at the last line of your code (when everything else has finished executing) and see if that helps.

Yes! I tried that, but my notebook just loaded forever and didn’t stop - or is that normal?

Edit: I think it’s normal, but it still doesn’t work when my laptop isn’t connected to the internet

I changed it, now I’m using Anvil as my server!

For the record, an Uplink program needs to be “awake” (running), and connected to the internet, if it is to “hear” and “respond to” requests from other programs. Those calls come in over the internet, and replies go back the same way.

1 Like