import gradio as gr from fastai.text.all import * import pathlib from pathlib import Path categories = ('Korean','Vietnamese') def predict_input_image(img): pred,idx,probs = learn_inf.predict(img) return dict(zip(categories,map(float,probs))) path = Path() temp = pathlib.PosixPath pathlib.PosixPath = pathlib.WindowsPath learn_inf = load_learner(path/'korean.pkl') image = gr.inputs.Image(shape=(180,180)) label = gr.outputs.Label(num_top_classes=2) gr.Interface(fn=predict_input_image, inputs=image, outputs=label,interpretation='default').launch(debug='True') iface.launch()