chun commited on
Commit
b509c08
1 Parent(s): 55dd1be

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -11
app.py CHANGED
@@ -4,12 +4,9 @@ from keras.preprocessing import image
4
  import gradio as gr
5
  from PIL import Image
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:
@@ -23,18 +20,13 @@ def a(img):
23
 
24
 
25
  input = gr.inputs.Image(type='pil', label="Original Image", source="upload", optional=True)
26
- #input_2 = gr.inputs.Image(type='pil', label="Original Image", source="webcam", optional=True)
27
- #inputs = [input, input_2]
28
  inputs = [input]
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__":
 
4
  import gradio as gr
5
  from PIL import Image
6
 
7
+ def a(img):
8
+ img = img.reshape( 64,64,3)
 
9
  model=load_model('./cats&dog.h5')
 
 
10
  test_image=np.expand_dims(img, axis=0)
11
  result=model.predict(test_image)
12
  if result[0][0]==1:
 
20
 
21
 
22
  input = gr.inputs.Image(type='pil', label="Original Image", source="upload", optional=True)
 
 
23
  inputs = [input]
24
  outputs = gr.outputs.Image(type="pil", label="Output Image")
25
  title = "Dog and Cat Object detection"
26
 
 
 
27
  image = gr.inputs.Image(shape=(64,64))
28
 
29
+ demo=gr.Interface(fn=a, inputs=image,examples=["photo/a01.jpg", "photo/a02.jpg","photo/a03.jpg","photo/a04.jpg"],outputs="text").launch(debug='True')
 
30
 
31
 
32
  if __name__ == "__main__":