RustyWhitePaper/HelloNeural
0
1import gradio as gr2from fastai.vision.all import load_learner3import pathlib, platform4 5plt = platform.system()6if plt == 'Linux': pathlib.WindowsPath = pathlib.PosixPath7 8learn_inf = load_learner('model.pkl')9 10def predict(image):11 pred, pred_idx, probs = learn_inf.predict(image)12 return f"I'm {probs[pred_idx]*100:.01f}% percent sure the class is {pred}"13 14demo = gr.Interface(fn=predict, inputs="image", outputs="text")15demo.launch()