jdmartinev's picture
Update app.py
03dbee2 verified
raw
history blame contribute delete
523 Bytes
import gradio as gr
from fastai.learner import load_learner
from fastai.vision.core import PILImage
from huggingface_hub import hf_hub_download
learner = load_learner(hf_hub_download("jdmartinev/isitabird","model.pkl"))
def classify_image(image):
img = PILImage.create(image)
pred_class, pred_idx, outputs = learner.predict(img)
return(f"Predicted class: {pred_class}")
gr.Interface(fn=classify_image,
inputs=gr.Image(width=224, height=224),
outputs="textbox").launch()