Spaces:
Runtime error
Runtime error
from fastai.vision.all import * | |
learn=load_learner('model.pkl') | |
def input_img(img): | |
race,_,probs = learn.predict(PILImage.create('img')) | |
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}") | |
return processed_output | |
categories=('Black people','White people') | |
def func_classi(img): | |
pred,idx,probs=learn.predict(img) | |
return dict(zip(categories,map(float,probs))) | |
import gradio as gr | |
examples=('Black people','White people') | |
demo = gr.Interface(fn=func_classi, inputs=[gr.Webcam()], outputs=[gr.Label(label="Results")]) | |
demo.launch(inline=False) |