File size: 810 Bytes
e5c9539
 
 
 
 
 
 
 
 
 
 
 
 
 
b9f4725
1eb26c4
f6de738
e5c9539
bb4af11
 
e5c9539
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from fastai.vision.all import *
import gradio as gr

categories = ('Chinese', 'Korean')

learn = load_learner('model.pkl')

def classify_image(img):
  pred, idx, prob = learn.predict(img)
  return dict(zip(categories, map(float, prob)))

image = gr.Image()
label = gr.Label()
examples = ['Beijing_hot_pot.jpg', 'chinese_hot_pot.jpg', 'Korean_hot_pot.jpg']
title = "Chinese vs. Koran Hot Pot Classifier " + "\U0001F60B"
description = "Build with <3 by your biggest hot pot fan!"
thumbnail = 'https:w7.pngwing.com/pngs/151/297/png-transparent-fondue-yo-hot-pot-menu-cooking-pot-food-orange-cooking-thumbnail.png'


demo = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples, allow_flagging = "never", title=title, description=description, thumbnail=thumbnail)
demo.launch(inline=False)