Upload 6 files
Browse filesAdded all the files
- examples/Croissant.png +0 -0
- examples/Tiles.jpg +0 -0
- examples/cat.jpg +0 -0
- examples/leaves.jpg +0 -0
- grado_test.py +19 -0
- orange_cats.pkl +3 -0
examples/Croissant.png
ADDED
examples/Tiles.jpg
ADDED
examples/cat.jpg
ADDED
examples/leaves.jpg
ADDED
grado_test.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
from fastai.vision.all import *
|
3 |
+
|
4 |
+
learn = load_learner('orange_cats.pkl')
|
5 |
+
|
6 |
+
labels = learn.dls.vocab
|
7 |
+
def predict(img):
|
8 |
+
img = PILImage.create(img)
|
9 |
+
pred,pred_idx,probs = learn.predict(img)
|
10 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
11 |
+
|
12 |
+
import gradio as gr
|
13 |
+
title = "Cat, croissant, leaves, or yellow tiles?"
|
14 |
+
description = "This model can classify images into 4 categories: cat, croissant, leaves, or yellow tiles. Upload an image or click an example image to test the model."
|
15 |
+
examples =['examples/cat.jpg', 'examples/Croissant.png', 'examples/leaves.jpg', 'examples/Tiles.jpg']
|
16 |
+
gr.Interface(fn=predict,examples=examples, title=title,description=description,inputs=gr.Image(), outputs=gr.Label(num_top_classes=3)).launch(share=True)
|
17 |
+
|
18 |
+
|
19 |
+
|
orange_cats.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:cf1c4258a948cd56892879c90e773e8b2b10f10b50588dcf080bbb2114e781c1
|
3 |
+
size 46981336
|