#!/usr/bin/env python | |
# coding: utf-8 | |
# In[ ]: | |
#from fastai.vision.widgets import * | |
from huggingface_hub import from_pretrained_fastai | |
learner = from_pretrained_fastai("/export.pkl") | |
#learn = learner.load(path/"export.pkl") | |
def classify_image(img): | |
pred,idx,probs = learn.predict(img) | |
return dict(zip(categories,map(float,probs))) | |
import gradio as gr | |
image = gr.inputs.Image(shape=(192,192)) | |
label = gr.outputs.Label() | |
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label) | |
intf.launch(inline=False) | |
# In[3]: | |
# In[4]: | |
# In[ ]: | |