Hi,
I am a newbie, sorry if this has been asked, tried searching for similar problem, couldn’t find it.
I am trying to run a simple cat/dog classification problem. however when I click submit, an error occurs.see below:(it seems as a newbie I can only attach one file for now, sorry for copy and paste)
File “/usr/local/lib/python3.7/dist-packages/keras_preprocessing/image/utils.py”, line 113, in load_img
with open(path, ‘rb’) as f:
TypeError: expected str, bytes or os.PathLike object, not numpy.ndarray
Gradio’s gr.inputs.Image already gives you a NumPy array representing the image, so load_img and img_to_array are not needed. If you need a specific size, this can be set using the shape parameter to gr.inputs.Image.
hi Beneyal,
thank you for the response. I also tried that and it did solved that error. However, it created a new one:
return {class_name[i]: float(results[i]) for i in range(2)}
IndexError: list index out of range.
this is the function in question.
Hmm… class_names is obviously of size 2, so the main suspect is results. Could you please inspect the shape of the prediction before the call to .tolist()?
it removed that error. now a new one pops up…crying:
File “/usr/local/lib/python3.7/dist-packages/numpy/core/fromnumeric.py”, line 44, in _wrapit
result = getattr(asarray(obj), method)(*args, **kwds)
TypeError: order must be str, not int
I trained a densenet121 model as s feature extractor. I can send you the serialized model.
I also used data augmentation(ImageDataGenerator) to preprocessed it, kindly forward me your email address and I’ll send you the model and the whole notebook.
thanks.