Spaces:
Sleeping
Sleeping
import gradio as gr | |
from fastai.vision.all import * | |
def greet(name): | |
return "Hello " + name + "!!" | |
learn = load_learner('condensed_model.pkl') | |
def classify_image(image): | |
prediction, idx, probabilities = learn.predict(image) | |
return dict(zip(learn.dls.vocab, map(float, probabilities))) | |
image = gr.inputs.Image(shape=(224, 224)) | |
label = gr.outputs.Label(num_top_classes=3) | |
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, capture_session=True) | |
intf.launch(inline=False) |