Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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('
|
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=('
|
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=('
|
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)
|