finalcar / app.py
johnmuchiri's picture
img
2289414
raw
history blame
1.27 kB
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()