#import pathlib from fastai.vision.all import * import gradio as gr #temp = pathlib.PosixPath #pathlib.PosixPath = pathlib.WindowsPath learn = load_learner('export.pkl') categories = ('chimpanzee', 'gorilla', 'orangutan') def classify_image(img): pred,idx,probs = learn.predict(img) return dict(zip(categories, map(float,probs))) examples = ['examples/gorilla50.jpg', 'examples/gorilla4.jpg', 'examples/chimpanzee36.jpg', 'examples/chimpanzee51.jpg', 'examples/chimpanzee35.jpg', 'examples/orangutan40.jpg'] title = "monkeys !!!" description = "classifies a monkey as an orangutan, chimpanzee, or gorilla" intf = gr.Interface(fn=classify_image, inputs=gr.Image(type="pil"), outputs=gr.Label(), title=title, description=description, examples=examples) intf.launch(share=True) #pathlib.PosixPath = temp