Spaces:
Sleeping
Sleeping
Upload 3 files
Browse files- app.py +23 -0
- itlarni_zoti_klassifikatsiyasi.pkl +3 -0
- requirements.txt +2 -0
app.py
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
+
import skimage
|
4 |
+
|
5 |
+
learn = load_learner('Dog_Type_Classified/itlarni_zoti_klassifikatsiyasi.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 = 'Dog type Classifier'
|
14 |
+
description = 'A dog type classifier trained on random images from internet with fastai. Created as a demo for Gradio and HuggingFace Spaces.'
|
15 |
+
#examples = ['GrizzlyBearJeanBeaufort.jpg']
|
16 |
+
|
17 |
+
gr.Interface(fn = predict,
|
18 |
+
inputs = 'image',
|
19 |
+
outputs = 'label',
|
20 |
+
title = title,
|
21 |
+
description = description
|
22 |
+
#examples = examples
|
23 |
+
).launch()
|
itlarni_zoti_klassifikatsiyasi.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:246e0042604a0d488eb4523e9191d69ba8a1f21fe4c789a3021f77280c3373bb
|
3 |
+
size 103096829
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
fastai
|
2 |
+
scikit-image
|