I am getting error

I am trying to run the tutorial of cat and dog predictor
from ._anvil_designer import Form1Template
from anvil import *
import anvil.server

class Form1(Form1Template):

def file_loader_1_change(self, file, **event_args):
“”“This method is called when a new file is loaded into this FileLoader.”""
result, score = anvil.server.call(‘classify_image’, file)

self.result_lbl.text = "%s (%0.2f)" % (result, score)
self.image_1.source = file

but when I run the form, I am getting this error

anvil.server.NoServerFunctionError: No server function matching “classify_image” has been registered at [Form1, line 10](javascript:void(0))

Anyone can help me please

Have you added a function called “classify_image” to your server module?

If you are confused, you can visit the docs Anvil Docs | Server Code

1 Like

Welcome to Anvil!

Firstly, please can you wrap your sample code blocks in triple backticks (```) as it makes it easier to read.

Secondly, as @divyeshlakhotia suggests there is no server function of that name defined. If you have declared the function make sure you have decorated it correctly, for example :

@anvil.server.callable
def classify_image(file):
    # code here.

Without the decorator @anvil.server.callable the function will not be registered correctly for a form to be able to call it.

1 Like

Defining that function is in step 6 of the tutorial. Have you done step 6?