chun
commited on
Commit
•
b548b33
1
Parent(s):
1d23043
Update app.py
Browse files
app.py
CHANGED
@@ -6,11 +6,11 @@ from PIL import Image
|
|
6 |
|
7 |
def a(img):
|
8 |
#img = img.reshape(1, 64, 64,3)
|
9 |
-
|
10 |
model=load_model('./cats&dog.h5')
|
11 |
#test_image=image.load_img("pic01.jpg",target_size=(64,64))
|
12 |
-
test_image=image.img_to_array(img)
|
13 |
-
test_image=np.expand_dims(
|
14 |
result=model.predict(test_image)
|
15 |
if result[0][0]==1:
|
16 |
prediction='Dog'
|
@@ -29,12 +29,13 @@ inputs = [input]
|
|
29 |
outputs = gr.outputs.Image(type="pil", label="Output Image")
|
30 |
title = "Dog and Cat Object detection"
|
31 |
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
|
|
38 |
|
39 |
if __name__ == "__main__":
|
40 |
demo.launch()
|
|
|
6 |
|
7 |
def a(img):
|
8 |
#img = img.reshape(1, 64, 64,3)
|
9 |
+
img = img.reshape( 64, 64,3)
|
10 |
model=load_model('./cats&dog.h5')
|
11 |
#test_image=image.load_img("pic01.jpg",target_size=(64,64))
|
12 |
+
#test_image=image.img_to_array(img)
|
13 |
+
test_image=np.expand_dims(img, axis=0)
|
14 |
result=model.predict(test_image)
|
15 |
if result[0][0]==1:
|
16 |
prediction='Dog'
|
|
|
29 |
outputs = gr.outputs.Image(type="pil", label="Output Image")
|
30 |
title = "Dog and Cat Object detection"
|
31 |
|
32 |
+
|
33 |
+
|
34 |
+
image = gr.inputs.Image(shape=(64,64))
|
35 |
+
|
36 |
+
|
37 |
+
demo=gr.Interface(fn=a, inputs=image,examples=["a01.jpg", "a02.jpg","a03.jpg","a04.jpg"],outputs="text").launch(debug='True')
|
38 |
+
|
39 |
|
40 |
if __name__ == "__main__":
|
41 |
demo.launch()
|