AGoretti commited on
Commit
ea27d9b
1 Parent(s): 13aa166

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastbook import *
2
+ from fastai.vision.widgets import *
3
+ from time import sleep
4
+ import gradio as gr
5
+
6
+ learned = load_learner('export.pkl')
7
+
8
+ categories = ('pink lady apple', 'red delicious apple', 'royal gala apple')
9
+ def classify_image(img):
10
+ pred,idx,probs = learned.predict(img)
11
+ return dict(zip(categories, map(float,probs)))
12
+
13
+ image = gr.inputs.Image(shape=(192,192))
14
+ label = gr.outputs.Label()
15
+ examples = ['maca.jpg', 'maca2.jpg', 'maca3.jpg']
16
+ intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
17
+ intf.launch(inline=False)