Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,14 +1,15 @@
|
|
1 |
-
|
2 |
-
|
3 |
learn=load_learner('model.pkl')
|
|
|
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')
|
13 |
demo = gr.Interface(fn=func_classi, inputs="image", outputs="label")
|
14 |
-
demo.launch(inline=False)
|
|
|
1 |
+
im=PILImage.create('white people.jpg')
|
2 |
+
im.thumbnail((192,192))
|
3 |
learn=load_learner('model.pkl')
|
4 |
+
|
5 |
categories=('white people','black people')
|
6 |
def func_classi(img):
|
7 |
pred,idx,probs=learn.predict(img)
|
8 |
return dict(zip(categories,map(float,probs)))
|
9 |
+
func_classi(im)
|
10 |
import gradio as gr
|
11 |
image=gr.inputs.Image(shape=(192,192))
|
12 |
label=gr.outputs.Label()
|
13 |
examples=('white people','black people')
|
14 |
demo = gr.Interface(fn=func_classi, inputs="image", outputs="label")
|
15 |
+
demo.launch(inline=False)
|