Spaces:
Sleeping
Sleeping
from fastai.vision.all import * | |
import gradio as gr | |
learn=load_learner('model.pkl') | |
categories = ['chimpanzee','gorilla','human', 'orangutan'] | |
def classify_image(img): | |
pred,idx,probs = learn.predict(img) | |
return dict(zip(categories, map(float,probs))) | |
image = gr.Image(shape=(192, 192)) | |
lable = gr.Label() | |
examples = ['chimpanzee.jpg', 'gorilla.jpg', 'human.jpg', 'orangutan.jpg'] | |
description = '''This project is inspired from the first lesson in the fast.ai course. | |
Choose an example photo or upload a photo of a Great Ape (Human, Chimpanzee, Gorilla, or Orangutan) to classify the Great Ape. | |
The classifier was trained using the fastai library to fine tune a ResNet-18 CNN model to classify Great Apes.''' | |
intf = gr.Interface(fn=classify_image, inputs=image, outputs=lable, examples=examples, title='Great Apes Classifier', description=description) | |
intf.launch(inline=False) |