from fastai.vision.all import * import gradio as gr learn = load_learner('gen_face_resnet_model.pkl') categories = ('notreal', 'real') def classify_image(img): pred,idx, probs = learn.predict(img) return (dict(zip(categories, map(float, probs)))) image = gr.Image(width=192, height=192) label = gr.Label() examples = ['person.jpg', 'ailo.jpg'] iface = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples) iface.launch()