File size: 604 Bytes
4fda772
3dadbf9
 
4fda772
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import gradio as gr
import numpy as np  
import tensorflow as tf


def classify_image(inp):
  new_image = np.zeros((120, 120, 4))

# Copy the original image to the first three channels of the new array
  new_image[:,:,0:3] = inp[:,:,:]

  model = tf.keras.models.load_model('poke.h5')
  prediction=np.argmax(model.predict(np.expand_dims(new_image,axis=0)))
  prediction=int(prediction)
  if prediction==1:
    return "Water"
  else:
    return "Fire"



gr.Interface(fn=classify_image, 
             inputs=gr.Image(shape=(120,120)),
             outputs=gr.Label(),
            
             ).launch()