How to upload files in a trained model to use it?


The title says the question. Here is the code which works in a colab. How can I convert it to make it work in the local env?:

import numpy as np
from google.colab import files
from keras.preprocessing import image
uploaded = files.upload()
for fn in uploaded.keys():

# predicting images
path = ‘/content/’ + fn
img = image.load_img(path, target_size=(300, 300))
x = image.img_to_array(img)
x = x / 255
x = np.expand_dims(x, axis=0)
images = np.vstack([x])
classes = model.predict(images, batch_size=10)
if classes[0]>0.5:
print(fn + ” is a human”)
print(fn + ” is a horse”)

submitted by /u/StarLan7
[visit reddit] [comments]

Leave a Reply

Your email address will not be published. Required fields are marked *