Spaces:
Sleeping
Sleeping
johnmuchiri
commited on
Commit
•
031da1c
1
Parent(s):
786f48f
let's deploy to huggingface spaces
Browse files- app.py +20 -0
- requirements.txt +0 -0
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
+
import skimage
|
4 |
+
|
5 |
+
learn = load_learner('export.pkl')
|
6 |
+
|
7 |
+
labels = learn.dls.vocab
|
8 |
+
def predict(img):
|
9 |
+
img = PILImage.create(img)
|
10 |
+
pred,pred_idx,probs = learn.predict(img)
|
11 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
12 |
+
|
13 |
+
title = "Benz BMW Classifier"
|
14 |
+
description = "A classifier that distinguishes between Benz and BMW ML classes of vehicles can be built using Resnet18."
|
15 |
+
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."
|
16 |
+
#examples = ['images/benz.jpg']
|
17 |
+
interpretation='default'
|
18 |
+
enable_queue=True
|
19 |
+
|
20 |
+
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,interpretation=interpretation,enable_queue=enable_queue).launch()
|
requirements.txt
ADDED
Binary file (3.31 kB). View file
|
|