muellerzr's picture
muellerzr HF staff
Actually push
582e715
raw
history blame contribute delete
476 Bytes
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()