rafaym commited on
Commit
7fe72e0
·
1 Parent(s): 3a0a958

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -1,13 +1,13 @@
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
  print(f"Probability it's a black person: {probs[0]:.4f}")
7
 
8
 
9
  #is_black(x) : return x[0].isupper()
10
- categories=('white people','black people')
11
  def func_classi(img):
12
  pred,idx,probs=learn.predict(img)
13
  return dict(zip(categories,map(float,probs)))
@@ -15,6 +15,6 @@ def func_classi(img):
15
 
16
  image=gr.inputs.Image(shape=(192,192))
17
  label=gr.outputs.Label()
18
- examples=('white people','black people')
19
  demo = gr.Interface(fn=func_classi, inputs="image", outputs="label")
20
  demo.launch(inline=False)
 
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
  print(f"Probability it's a black person: {probs[0]:.4f}")
7
 
8
 
9
  #is_black(x) : return x[0].isupper()
10
+ categories=('White people','Black people')
11
  def func_classi(img):
12
  pred,idx,probs=learn.predict(img)
13
  return dict(zip(categories,map(float,probs)))
 
15
 
16
  image=gr.inputs.Image(shape=(192,192))
17
  label=gr.outputs.Label()
18
+ examples=('White people','Black people')
19
  demo = gr.Interface(fn=func_classi, inputs="image", outputs="label")
20
  demo.launch(inline=False)