Spaces:
Runtime error
Runtime error
from fastai.vision.all import * | |
import gradio as gr | |
learn=load_learner('model.pkl') | |
is_black,_,probs = learn.predict(PILImage.create('black people.jpg')) | |
print(f"This is a: {is_black}.") | |
processed_output = print(f"Probability it's a black person: {probs[0]:.4f}") | |
return processed_output | |
#is_black(x) : return x[0].isupper() | |
categories=('white people','black people') | |
def func_classi(img): | |
pred,idx,probs=learn.predict(img) | |
return dict(zip(categories,map(float,probs))) | |
image=gr.inputs.Image(shape=(192,192)) | |
label=gr.outputs.Label() | |
examples=('white people','black people') | |
demo = gr.Interface(fn=func_classi, inputs="image", outputs="label") | |
demo.launch(inline=False) | |