Bmw-Clasifier / app.py
Asinsayed's picture
Update app.py
4442ced verified
raw
history blame contribute delete
882 Bytes
#!/usr/bin/env python
# coding: utf-8
import gradio as gr
from fastai.vision.all import *
learn = load_learner('model.pkl')
categories = learn.dls.vocab
def classify_images(img):
pred,predx,probs=learn.predict(img)
return dict(zip(categories,map(float,probs)))
gr.Interface(fn=classify_images,
inputs=gr.components.Image(height=512, width=512),
outputs=gr.components.Label(num_top_classes=3),
title='Bmw Mercedes classifier',
description='A classifier for BMW and Benz',
theme='freddyaboulton/dracula_revamped',
article="<p style='text-align: center'><a href='https://colab.research.google.com/drive/1ueKfsnT24TOp2pv4GHblLplPo6EtZS06?usp=sharing' target='_blank'>Reference</a></p>",
examples=['Bmw.jpg','e-class-exterior-right-front-three-quarter-27.webp']
).launch()