Abhi101 commited on
Commit
046c9b0
1 Parent(s): 618cd15

Add application file

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from tensorflow import keras
2
+ import gradio as gr
3
+ path_to_model = "RiceLeafDisease/Model/my_model_new_vgg.h5"
4
+
5
+ model = keras.models.load_model(path_to_model)
6
+
7
+ def classify_image(inp):
8
+ # inp = load_image(inp_path)
9
+ inp = inp.reshape((-1, 224, 224, 3))
10
+ prediction = model.predict(inp).tolist()[0]
11
+ class_names = ['Bacterialblight', 'Blast', 'Brownspot', 'Tungro']
12
+ return {class_names[i]: prediction[i] for i in range(4)}
13
+
14
+
15
+ iface = gr.Interface(fn=classify_image,
16
+ inputs=gr.inputs.Image(shape=(224, 224)),
17
+ outputs=gr.outputs.Label(num_top_classes=4),
18
+ )
19
+ iface.launch(debug=True)