Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -7,8 +7,10 @@ import gradio as gr
|
|
7 |
def input_img(img):
|
8 |
learn=load_learner('model.pkl')
|
9 |
race,_,probs = learn.predict(PILImage.create(img))
|
10 |
-
print(f"This is a: {race}.")
|
11 |
-
|
|
|
|
|
12 |
categories=('Black people','White people')
|
13 |
def func_classi(img):
|
14 |
pred,idx,probs=learn.predict(img)
|
@@ -18,6 +20,7 @@ image=gr.inputs.Image(shape=(192,192))
|
|
18 |
label=gr.outputs.Label()
|
19 |
examples=('Black people','White people')
|
20 |
demo = gr.Interface(fn=func_classi, inputs="image", outputs="label")
|
|
|
21 |
demo.launch(inline=False)
|
22 |
|
23 |
#image=gr.inputs.Image(shape=(192,192))
|
|
|
7 |
def input_img(img):
|
8 |
learn=load_learner('model.pkl')
|
9 |
race,_,probs = learn.predict(PILImage.create(img))
|
10 |
+
#print(f"This is a: {race}.")
|
11 |
+
processed_output=(f"This is a: {race}./nProbability it's a black person: {probs[0]:.4f}.\nProbability it's a white person: {probs[1]:.4f}")
|
12 |
+
return processed_output
|
13 |
+
|
14 |
categories=('Black people','White people')
|
15 |
def func_classi(img):
|
16 |
pred,idx,probs=learn.predict(img)
|
|
|
20 |
label=gr.outputs.Label()
|
21 |
examples=('Black people','White people')
|
22 |
demo = gr.Interface(fn=func_classi, inputs="image", outputs="label")
|
23 |
+
#demo = gr.Interface(fn=input_img, inputs="image", outputs="label")
|
24 |
demo.launch(inline=False)
|
25 |
|
26 |
#image=gr.inputs.Image(shape=(192,192))
|