Error with deepnote

What I’m trying to do:
I am deploying a model that I have in deepnote so that the result appears in the anvil interface, and I get the following error [anvil.server.NoServerFunctionError: No server function matching “detect_error” has been registered]

What I’ve tried and what doesn’t work:
I cloned the tutorial app (Deploy Machine Learning to the Web with Deepnote) that explains this (Anvil | Login) and the same thing appears error [anvil.server.NoServerFunctionError: No server function matching “classify_image” has been registered]

Code Sample:

def emplazamiento_change(self, file, **event_args):
“This method is called when a new file is loaded into this FileLoader”“”
text = anvil.server.call(‘detect_error’, file)

self.result_lbl.text = f"{text}"

`


**Clone link:**
https://fdhrm6a4sn4hkumo.anvil.app/DAF3SMHREH7JBDDKBGWFTBC3
*share a copy of your app*

Hi, @new_pystronaut_6 and welcome to the forum!

Can you give a few more details as to what steps you’ve followed so far, exactly? Have you enabled the Uplink and added your key to your notebook?

Hi Patricia, thank you!

Yes, I enabled uplinking in Anvil and Deepnote as per the tutorial, below I add the images.

Uploading: Captura de pantalla 2024-02-14 112749.png…
Uploading: Captura de pantalla 2024-02-14 113220.png…

Hi, @new_pystronaut_6

Following up on what @patricia suggested, Let’s explore that error message,
No server function matching “detect_error” has been registered

This indicates that your Anvil app is unaware of any function named "detect_error"

  1. Ensure "detect_error" is callable
    You’ll need to establish a connection to that code using anvil-uplink to make it callable from your Anvil app. To confirm if you’ve set it up correctly, refer to this quickstart.

  2. Ensure "detect_error" stays callable
    If the uplink code has already completed its execution by the time you call it from your app, it won’t work. You can add anvil.server.wait_forever() at the end of your script to keep it waiting to process future calls.

Generally, it should look like this:

import anvil.server

anvil.server.connect("<your Server Uplink key>")

@anvil.server.callable
def detect_error(**args):
  # run your logic

anvil.server.wait_forever()
1 Like

I keep getting the same error,

1. Deepnote code:

#CONNECT TO ANVIL

import anvil.server

anvil.server.connect(" key ")

import anvil.media

@anvil.server.callable
def detect_error(file):
# logic

return errores_detectados_str

anvil.server.wait_forever()

2. Anvil code:

def emplazamiento_change(self, file, **event_args):
"This method is called when a new file is loaded into this FileLoader"""
text = anvil.server.call('detect_error', file)

self.result_lbl.text = f"{text}"``

3. Uplink:

Hi @new_pystronaut_6 ,

It seems like you’re using the client uplink key. Just to clarify, the client uplink has limited capabilities. It can’t register callable functions, but only call existing ones.

To address this, consider using the server uplink instead. This will give you the ability to both register and call functions.

Let me know if that helps!

1 Like

Thank you very much, that was the solution. Greetings

1 Like