I finally got to the point where I was ready to deploy my model, and as always, nothing works as advertised:
I created my inference notebook with this simple code, which runs just fine in Jupyter Notebooks:
from utils import *
from fastai2.vision.widgets import *
from fastai2.vision.all import *
inferencer = load_learner('export.pkl')
btn_upload = widgets.FileUpload()
out_pl = widgets.Output()
lbl_pred = widgets.Label()
# listener method:
def on_click_classify(change):
img = PILImage.create(btn_upload.data[-1])
out_pl.clear_output()
with out_pl:
display(img.to_thumb(128,128))
pred, idx, probs = inferencer.predict(img)
lbl_pred.value = f'Predicted {pred} with {probs[idx]*100:.01f}% certainty'
btn_run.on_click(on_click_classify)
VBox([
widgets.Label('Squash IT!'),
btn_upload,
btn_run,
out_pl,
lbl_pred
])
Then I click âvoilaâ to run it and I get a very cryptic error message:
There was an error when executing cell [6]. Please run Voila with --debug to see the error message.
I try running âvoila inference.ipynb --debugâ to see what the error is, but get this back:
[Voila] Voila is running at:
http://localhost:8866/
WARNING | No web browser found: could not locate runnable browser
As a side note, I try this both on my local terminal where I SSH into my VM, and on the Cloud Console provided command line.
Nothing is running on port 8886 on local machine, which makes sense since Iâm using Google Cloud. But I canât navigate to wherever voila is running on the cloud. So, I decide to just pull the repo down to my local machine and try it there, but my notebook wonât run at all on my local machine because of this totally unrelated error:
NotImplementedError: cannot instantiate 'PosixPath' on your system
,
which I read somewhere MIGHT be because Iâve been developing the notebook on Google Cloud, which is using a Unix virtual machine, and it wonât run because my local machine is windows.
So basically, I never got to find out why Voila wonât work, and Iâve been stuck on trying to deploy my model for 3 days.
Am I the only one having this many problems? Does anyone have a solution to any of these numerous problems?