Keemoz0's picture
pushingfullapp
ed4ddd2
raw
history blame contribute delete
572 Bytes
import gradio as gr
from fastai.vision.all import *
def is_cat(x):
return x[0].isupper()
learn = load_learner('haircutmodel3.pkl')
categories = ('low taper','low fade','bald','mullet','mohawk')
def classify_image(img):
pred, idx, probs = learn.predict(img)
return dict(zip(categories, map(float, probs)))
# Remove 'shape' argument from gr.Image()
image = gr.Image(type="pil") # You can specify the image type here, like 'pil' for PIL images
label = gr.Label()
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label)
intf.launch(inline=False)