Amy commited on
Commit
e5c9539
1 Parent(s): a5bd787

create app

Browse files
Files changed (4) hide show
  1. Beijing_hot_pot.jpg +0 -0
  2. Korean_hot_pot.jpg +0 -0
  3. app.py +17 -0
  4. chinese_hot_pot.jpg +0 -0
Beijing_hot_pot.jpg ADDED
Korean_hot_pot.jpg ADDED
app.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastai.vision.all import *
2
+ import gradio as gr
3
+
4
+ categories = ('Chinese', 'Korean')
5
+
6
+ learn = load_learner('model.pkl')
7
+
8
+ def classify_image(img):
9
+ pred, idx, prob = learn.predict(img)
10
+ return dict(zip(categories, map(float, prob)))
11
+
12
+ image = gr.Image()
13
+ label = gr.Label()
14
+ examples = ['Beijing_hot_pot.jpg', 'chinese_hot_pot.jpg', 'Korean_hot_pot.jpg']
15
+
16
+ demo = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples, allow_flagging = "never")
17
+ demo.launch(inline=False)
chinese_hot_pot.jpg ADDED