Spaces:
Runtime error
Runtime error
File size: 666 Bytes
8c3eaa3 10e0c92 dfb96ee 10e0c92 8c3eaa3 ea99d48 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
import gradio as gr
import tensorflow as tf
from tensorflow.keras.preprocessing import image
import matplotlib.pyplot as plt
import numpy as np
model = tf.keras.models.load_model('dogcat_model_bak.h5')
def image_classifier(img):
img1 = image.load_img(str(img), target_size=(64, 64))
img1 = image.img_to_array(img1)
img1 = img1/255
img1 = np.expand_dims(img1, axis=0)
res = model.predict(img, batch_size=None,steps=1)
if(res[:,:]>0.5):
value ='Dog :%1.2f'%(prediction[0,0])
else:
value ='Cat :%1.2f'%(1.0-prediction[0,0])
return value
demo = gr.Interface(fn=image_classifier, inputs="image", outputs="label")
demo.launch() |