import gradio as gr from fastai.learner import load_learner from fastai.vision.core import PILImage # Load the model learn = load_learner('../exported_fastai.pkl', cpu=False) def classify_image(inp): inp = PILImage.create(inp) pred, _, _ = learn.predict(inp) return pred iface = gr.Interface( fn=classify_image, inputs=gr.inputs.Image(), outputs="text", title="Fastai Classifier", description="An example of using Fastai in Gradio.", ).launch()