FileNotFoundError while taking input an image in "load_img" in keras in jupyter notebook

Viewed 208

FileNotFoundError while taking input an image in "load_img" in keras in jupyter notebook

import pickle
import numpy as np
from tensorflow.keras.preprocessing.image import ImageDataGenerator,load_img
import json
import requests
import PIL
import matplotlib.pyplot as plt

img=np.array(load_img("IMG_2996.jpg").resize((224,224))).tolist() #Iam getting problem here,in jupyter notebook it is showing filenotfound


url='http://127.0.0.1:5000/model'


requested_data=json.dumps({'img':img})
response = requests.post(url,requested_data)
response.text
1 Answers

Your image file is not in the same directory as your current working directory. This will tell you the directory it's looking for.

import os
print(os.getcwd())

Correct your relative path or use an absolute path.

Related