jesherjoshua commited on
Commit
4fda772
·
1 Parent(s): 90e3888

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -0
app.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+
4
+
5
+ def classify_image(inp):
6
+ new_image = np.zeros((120, 120, 4))
7
+
8
+ # Copy the original image to the first three channels of the new array
9
+ new_image[:,:,0:3] = inp[:,:,:]
10
+
11
+ model = tf.keras.models.load_model('poke.h5')
12
+ prediction=np.argmax(model.predict(np.expand_dims(new_image,axis=0)))
13
+ prediction=int(prediction)
14
+ if prediction==1:
15
+ return "Water"
16
+ else:
17
+ return "Fire"
18
+
19
+
20
+
21
+ gr.Interface(fn=classify_image,
22
+ inputs=gr.Image(shape=(120,120)),
23
+ outputs=gr.Label(),
24
+
25
+ ).launch()