regidancodes commited on
Commit
aced369
1 Parent(s): 54ed9a2
Files changed (1) hide show
  1. app.py +19 -0
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from keras.models import load_model,Sequential
3
+ model = load_model("./Model_2.h5")
4
+ class_names = ['daisy', 'dandelion', 'roses', 'sunflowers', 'tulips']
5
+
6
+ def predict_image(img):
7
+ img_4d=img.reshape(-1,331,331,3)
8
+ prediction=model.predict(img_4d)[0]
9
+ return {class_names[i]: float(prediction[i]) for i in range(5)}
10
+
11
+ image = gr.inputs.Image(shape=(331,331))
12
+ label = gr.outputs.Label(num_top_classes=5)
13
+ iface = gr.Interface(fn=predict_image,
14
+ inputs=image,
15
+ outputs=label,
16
+ interpretation='default',
17
+ title = 'Flower Recognition App',
18
+ description= 'Get probability for input image among 5 classes')
19
+ iface.launch()