Trying to create a web app using streamlit and fastai, I get the following error when I click on “classify.”
***AttributeError: 'NoneType' object has no attribute 'update'***
Weirdly enough, I tried the exact same method last year with no trouble. Could anyone suggest a solution.
Here is the traceback below:
File "/usr/local/lib/python3.7/dist-packages/streamlit/script_runner.py", line 430, in _run_script
exec(code, module.__dict__)
File "/content/app.py", line 45, in <module>
predictor = Predict(file_name)
File "/content/app.py", line 21, in __init__
self.get_prediction()
File "/content/app.py", line 36, in get_prediction
pred, pred_idx, probs = self.learn_inference.predict(self.img)
File "/usr/local/lib/python3.7/dist-packages/fastai/learner.py", line 266, in predict
inp,preds,_,dec_preds = self.get_preds(dl=dl, with_input=True, with_decoded=True)
File "/usr/local/lib/python3.7/dist-packages/fastai/learner.py", line 253, in get_preds
self._do_epoch_validate(dl=dl)
File "/usr/local/lib/python3.7/dist-packages/fastai/learner.py", line 203, in _do_epoch_validate
with torch.no_grad(): self._with_events(self.all_batches, 'validate', CancelValidException)
File "/usr/local/lib/python3.7/dist-packages/fastai/learner.py", line 163, in _with_events
try: self(f'before_{event_type}'); f()
File "/usr/local/lib/python3.7/dist-packages/fastai/learner.py", line 141, in __call__
def __call__(self, event_name): L(event_name).map(self._call_one)
File "/usr/local/lib/python3.7/dist-packages/fastcore/foundation.py", line 155, in map
def map(self, f, *args, gen=False, **kwargs): return self._new(map_ex(self, f, *args, gen=gen, **kwargs))
File "/usr/local/lib/python3.7/dist-packages/fastcore/basics.py", line 698, in map_ex
return list(res)
File "/usr/local/lib/python3.7/dist-packages/fastcore/basics.py", line 683, in __call__
return self.func(*fargs, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/fastai/learner.py", line 145, in _call_one
for cb in self.cbs.sorted('order'): cb(event_name)
File "/usr/local/lib/python3.7/dist-packages/fastai/callback/core.py", line 45, in __call__
if self.run and _run: res = getattr(self, event_name, noop)()
File "/usr/local/lib/python3.7/dist-packages/fastai/callback/progress.py", line 26, in before_validate
def before_validate(self): self._launch_pbar()
File "/usr/local/lib/python3.7/dist-packages/fastai/callback/progress.py", line 35, in _launch_pbar
self.pbar.update(0)
File "/usr/local/lib/python3.7/dist-packages/fastprogress/fastprogress.py", line 56, in update
self.update_bar(0)
File "/usr/local/lib/python3.7/dist-packages/fastprogress/fastprogress.py", line 76, in update_bar
else: self.on_update(val, f'{100 * val/self.total:.2f}% [{val}/{self.total} {elapsed_t}<{remaining_t}{end}]')
File "/usr/local/lib/python3.7/dist-packages/fastprogress/fastprogress.py", line 127, in on_update
if self.display: self.out.update(HTML(self.progress))