rafaym commited on
Commit
f703f2c
·
1 Parent(s): d78bec8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -1,12 +1,19 @@
1
  from fastai.vision.all import *
 
2
  learn=load_learner('model.pkl')
3
- is_black(x) : return x[0].isupper()
 
 
 
 
 
 
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')
 
1
  from fastai.vision.all import *
2
+ import gradio as gr
3
  learn=load_learner('model.pkl')
4
+ is_black,_,probs = learn.predict(PILImage.create('black people.jpg'))
5
+ print(f"This is a: {is_black}.")
6
+ processed_output = print(f"Probability it's a black person: {probs[0]:.4f}")
7
+ return processed_output
8
+
9
+
10
+ #is_black(x) : return x[0].isupper()
11
  categories=('white people','black people')
12
  def func_classi(img):
13
  pred,idx,probs=learn.predict(img)
14
  return dict(zip(categories,map(float,probs)))
15
 
16
+
17
  image=gr.inputs.Image(shape=(192,192))
18
  label=gr.outputs.Label()
19
  examples=('white people','black people')