Here is link of my colab notebook:
https://colab.research.google.com/drive/1h47l-WESCVJXZ-MzJLQQF-lpH4b3fgK0#scrollTo=GNM1sCkpl_VG
Please help in converting my ML model to a web app.
I need correct python code for my ML model to connect it with a anvil server and getting correct answer by running in anvil.
Here is link of my anvil app code:
https://anvil.works/build#app:PYM64KZICXLRQYYE
PLEASE HELP!
Hi @sanketgupta589 and welcome
you need to paste a copy-app link, the one you can find here:
Also, manage appropriately the permissions on the colab notebook: I tried opening it and got a “no access” error.
BR
Sir,
here i am giving both links with updated permissions please go to these links and edit the code for same.
Please Help!
As soon as possible
Here I am giving the link of my anvil app: https://anvil.works/build#clone:PYM64KZICXLRQYYE=4ZXAIGJXPJM477MXHJQCXNV7
Here I am giving the link of my colab notebook: https://colab.research.google.com/drive/1h47l-WESCVJXZ-MzJLQQF-lpH4b3fgK0?usp=sharing
Thanks
Hi @sanketgupta589,
“Please help me…I need correct python code” isn’t very specific – if someone wants to help you (and remember, most people on this forum are volunteers), you’re asking them to do a lot of work for you!
If you want help with a problem, you should identify:
- What piece of your code isn’t working
- What that code is supposed to do
- What you have tried
- What errors or behaviours you are seeing instead of the correct behaviour
Please read our guide to asking a good question, plus this step-by-step example where we took a vague question like this and turned it into something that’s easy to answer!
3 Likes
Hi @sanketgupta589
@meredydd 's absolutely right, your question is quite vague, btw I took a look at your code and colab notebook.
I think you’re just missing the correct import
statements.
I modified the code only in the last section of the colab notebook and now this:
import anvil.media
from keras.preprocessing import image
import numpy as np
@anvil.server.callable
def classify_image(file):
with anvil.media.TempFile(file) as filename:
img = image.load_img(filename)
img = img.resize((128,128),resample=PIL.Image.BICUBIC)
arr = image.img_to_array(img)
arr = np.expand_dims(arr, axis=0)
arr /= 255.0
score = model.predict(img_data)
return('normal' if New_pred==[1] else 'corona',float(score))
is giving error only on the score = model.predict(img_data)
line.
Before my modifications errors were:
- NameError: name ‘img_to_array’ is not defined
- NameError: name ‘np’ is not defined
You need the right import statement. I was trying to fix it but unfortunately I happened to hit the “Restart Runtime and execute all” and I lost authentication over the google drive mount.
So, either you restart the engine and execute it again or you can try to figure out the import to add to the last section.
Hope this helps.
BR
1 Like
Again a error is occurring, please help in resolving this
anvil.server.UplinkDisconnectedError: The uplink server for “classify_image” has been disconnected
at Form1, line 16