rafaym commited on
Commit
326e30b
·
1 Parent(s): fd6ee30

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -1,14 +1,15 @@
1
  from fastai.vision.all import *
2
  import gradio as gr
3
- learn=load_learner('model.pkl')
4
- race,_,probs = learn.predict(PILImage.create(img))
5
- print(f"This is a: {race}.")
6
- print(f"Probability it's a black person: {probs[0]:.4f}.\nProbability it's a white person: {probs[1]:.4f}")
7
 
8
 
9
  #is_black(x) : return x[0].isupper()
10
  categories=('Black people','White people')
11
  def func_classi(img):
 
 
 
 
 
12
  pred,idx,probs=learn.predict(img)
13
  return dict(zip(categories,map(float,probs)))
14
 
 
1
  from fastai.vision.all import *
2
  import gradio as gr
 
 
 
 
3
 
4
 
5
  #is_black(x) : return x[0].isupper()
6
  categories=('Black people','White people')
7
  def func_classi(img):
8
+ learn=load_learner('model.pkl')
9
+ race,_,probs = learn.predict(PILImage.create(img))
10
+ print(f"This is a: {race}.")
11
+ print(f"Probability it's a black person: {probs[0]:.4f}.\nProbability it's a white person: {probs[1]:.4f}")
12
+
13
  pred,idx,probs=learn.predict(img)
14
  return dict(zip(categories,map(float,probs)))
15