File size: 657 Bytes
65fb4e8
 
ff1c54d
a7e12eb
65fb4e8
 
 
 
 
 
 
 
 
 
ccbcc17
 
65fb4e8
 
42efdec
ccbcc17
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from tensorflow import keras
import gradio as gr

path_to_model = "modelPredict.h5"

model = keras.models.load_model(path_to_model)

def classify_image(inp):
    # inp = load_image(inp_path)
    inp = inp.reshape((-1, 224, 224, 3))
    prediction = model.predict(inp).tolist()[0]
    class_names = ['Bacterialblight', 'Blast', 'Brownspot', 'Tungro']
    return {class_names[i]: prediction[i] for i in range(4)}


iface = gr.Interface(fn=classify_image, 
             inputs=gr.inputs.Image(shape=(224, 224)),
             outputs=gr.outputs.Label(num_top_classes=4),
             title = "PREDICT PADDY LEAF DISEASES"
             )
iface.launch(debug=True)