amoghv commited on
Commit
95c5724
·
1 Parent(s): 90a0fc3

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ !pip install -Uqq fastai
2
+ !pip install gradio
3
+ !pip install nbdev
4
+ from fastai.vision.all import *
5
+ import gradio as gr
6
+ import nbdev
7
+
8
+ learn = load_learner('fast-food-model.pkl')
9
+
10
+ categories = ('Baked Potato', 'Burger', 'Crispy Chicken', 'Donut', 'Fries','Hot Dog','Pizza','Sandwich','Taco','Taquito')
11
+ def classify_image (image):
12
+ pred,idx,prob = learn.predict(image)
13
+ return dict(zip(categories, map(float, probs)))
14
+
15
+ image = gr.inputs(Image(shape=(192, 192)))
16
+ labels = gr.outputs.Label()
17
+
18
+ intf = gr.Interface(fn = classify_image, inputs = image, outputs = labels)
19
+ intf.launch(inline = False)
20
+