moro23 commited on
Commit
4e94087
·
1 Parent(s): 7a7df37

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastbook import *
2
+ import gradio as gr
3
+
4
+ #def get_y(o):
5
+ # return [parent_label(o)]
6
+
7
+ ## lets load the model
8
+ learn_inf = load_learner('single_label_maize_disease_classifier.pkl')
9
+
10
+
11
+
12
+ def maize_disease_classifier(image):
13
+ pred,pred_idx,probs = learn_inf.predict(image)
14
+ pred_name = f"Prediction: {pred}"
15
+ pred_prob = f"Probability: {probs[pred_idx]}"
16
+ pred_array = pred_idx
17
+ return pred_name, pred_prob, pred_array
18
+
19
+
20
+ iface = gr.Interface(fn=maize_disease_classifier, inputs=gr.inputs.Image(shape=(224, 224)), \
21
+ outputs=["text", "number", "text"])
22
+
23
+ iface.launch(inline=False)