asaripa3's picture
Update app.py
5d251cd verified
raw
history blame contribute delete
541 Bytes
#!/usr/bin/env python
# In[68]:
import gradio as gr
#|export
from fastai.vision.all import *
# In[70]:
#|export
learn = load_learner("race_model.pkl")
# In[71]:
#learn.predict(im)
# In[72]:
#|export
categories = learn.dls.vocab
def classify_image(img):
pred, Tax, probs = learn.predict(img)
return dict(zip(categories, map(float, probs)))
# In[73]:
#classify_image(im)
# In[74]:
#|export
demo = gr.Interface(fn=classify_image, inputs="image", outputs="label", examples=["1.jpg", "2.jpg", "3.jpg"])
demo.launch(inline=False)