Spaces:
Sleeping
Sleeping
File size: 479 Bytes
98e8a80 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
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() |