| import gradio as gr | |
| from fastbook import * | |
| learn = load_learner("export.pkl") | |
| def image_classifier(inp): | |
| if inp.shape[0] != 400: | |
| inp = np.resize(inp, (192, 192, 3)) | |
| res, _, probs = learn.predict(inp) | |
| print(res, probs) | |
| return f"{res} {probs}" | |
| demo = gr.Interface(fn=image_classifier, inputs="image", outputs="label") | |
| demo.launch() |