Lynx_or_Cat / app.py
SaraGV22's picture
Change hub profile
3a90806 verified
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("SaraGV22/Lynx_or_Cat","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()