Spaces:
Sleeping
Sleeping
File size: 1,272 Bytes
031da1c 2289414 031da1c 28a2d71 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import gradio as gr
from fastai.vision.all import *
learn = load_learner('export.pkl')
labels = learn.dls.vocab
def predict(img):
img = PILImage.create(img)
pred,pred_idx,probs = learn.predict(img)
return {labels[i]: float(probs[i]) for i in range(len(labels))}
title = "Benz BMW Classifier"
description = "A classifier that distinguishes between Benz and BMW ML classes of vehicles can be built using Resnet18."
article="ResNet18 is a type of deep neural network that can be used for image classification tasks, including distinguishing between different classes of vehicles such as Benz and BMW ML classes.To use ResNet18 for this task, a dataset of images of Benz and BMW ML class vehicles would be needed. The images would be used to train the ResNet18 model to learn the visual patterns that distinguish between the two classes of vehicles."
examples= ['images/benz.jpg','images/benz1.jpg','images/benz2.jpg','images/bmw1.jpg','images/bmw2.jpg','images/bmw3.jpg']
interpretation='default'
enable_queue=True
gr.Interface(fn=predict,inputs=gr.inputs.Image(shape=(512, 512)),outputs=gr.outputs.Label(num_top_classes=2),title=title,description=description,article=article,examples=examples,interpretation=interpretation,enable_queue=enable_queue).launch() |