File size: 600 Bytes
4e94087
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from fastbook import *
import gradio as gr 

#def get_y(o):
# return [parent_label(o)]
  
## lets load the model 
learn_inf = load_learner('single_label_maize_disease_classifier.pkl')



def maize_disease_classifier(image):
  pred,pred_idx,probs = learn_inf.predict(image)
  pred_name = f"Prediction:  {pred}"
  pred_prob = f"Probability:  {probs[pred_idx]}"
  pred_array = pred_idx
  return pred_name, pred_prob, pred_array
  
 
iface = gr.Interface(fn=maize_disease_classifier, inputs=gr.inputs.Image(shape=(224, 224)), \
             outputs=["text", "number", "text"])

iface.launch(inline=False)