Thomas Laurent
commited on
Commit
•
3b7385e
1
Parent(s):
bd6e410
initial commit
Browse files- .DS_Store +0 -0
- .ipynb_checkpoints/Untitled-checkpoint.ipynb +6 -0
- app.py +20 -0
- model.pkl +3 -0
- requirements.txt +2 -0
.DS_Store
ADDED
Binary file (6.15 kB). View file
|
|
.ipynb_checkpoints/Untitled-checkpoint.ipynb
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [],
|
3 |
+
"metadata": {},
|
4 |
+
"nbformat": 4,
|
5 |
+
"nbformat_minor": 5
|
6 |
+
}
|
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('model.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 = "Bear/Teddy bear Classifier"
|
14 |
+
interpretation='default'
|
15 |
+
enable_queue=True
|
16 |
+
|
17 |
+
gr.Interface(fn=predict,inputs=gr.inputs.Image(shape=(512, 512)),
|
18 |
+
outputs=gr.outputs.Label(num_top_classes=3),
|
19 |
+
title=title,interpretation=interpretation,
|
20 |
+
enable_queue=enable_queue).launch()
|
model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:402d742adfd1c851f2bb73c90ccce82124992163b849c0b5d6c3c19bd0a49cc3
|
3 |
+
size 46965281
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
fastai
|
2 |
+
scikit-image
|