rafaym commited on
Commit
31eb1e1
·
1 Parent(s): 8acb917

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -1,14 +1,15 @@
1
- pip install fastai==1.0.58
2
- from fastai.vision import load_learner
3
  learn=load_learner('model.pkl')
 
4
  categories=('white people','black people')
5
  def func_classi(img):
6
  pred,idx,probs=learn.predict(img)
7
  return dict(zip(categories,map(float,probs)))
8
-
9
  import gradio as gr
10
  image=gr.inputs.Image(shape=(192,192))
11
  label=gr.outputs.Label()
12
  examples=('white people','black people')
13
  demo = gr.Interface(fn=func_classi, inputs="image", outputs="label")
14
- demo.launch(inline=False)
 
1
+ im=PILImage.create('white people.jpg')
2
+ im.thumbnail((192,192))
3
  learn=load_learner('model.pkl')
4
+
5
  categories=('white people','black people')
6
  def func_classi(img):
7
  pred,idx,probs=learn.predict(img)
8
  return dict(zip(categories,map(float,probs)))
9
+ func_classi(im)
10
  import gradio as gr
11
  image=gr.inputs.Image(shape=(192,192))
12
  label=gr.outputs.Label()
13
  examples=('white people','black people')
14
  demo = gr.Interface(fn=func_classi, inputs="image", outputs="label")
15
+ demo.launch(inline=False)