Hello, I’m in the part of deploying to Hugging Face
My app.py file is like this :
all = [‘load_learner’,‘learn_inf’, ‘classify_image’, ‘categories’, ‘image’, ‘label’, ‘intf’]
from fastai.vision.widgets import *
import gradio as gr
learn = load_learner(‘export.pkl’)
categories = (‘grizzly’,‘black’,‘teddy’)
def classify_image(img):
pred,idx,probs = learn.predict(img)
return dict(zip(categories, map(float,probs)))
image = “image”
label = “label”
examples = [‘grizzly.jpg’, ‘black.jpg’, ‘teddy.jpg’]
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
intf.launch(inline=False)
I keep getting error :
Traceback (most recent call last):
File “/home/user/app/app.py”, line 6, in
learn = load_learner(‘export.pkl’)
NameError: name ‘load_learner’ is not defined
Traceback (most recent call last):
File “/home/user/app/app.py”, line 6, in
learn = load_learner(‘export.pkl’)
NameError: name ‘load_learner’ is not defined
What am I missing here?
My files :
