Spaces:
Runtime error
Runtime error
CodeRookieUtkarsh
commited on
Commit
•
2e05424
1
Parent(s):
8e75d23
version 1.0
Browse files- README.md +11 -5
- app.py +32 -0
- examples/agkistrodon-contortrix.jpg +0 -0
- examples/haldea-striatula.jpg +0 -0
- examples/masticophis-flagellum.jpg +0 -0
- examples/storeria-occipitomaculata.jpg +0 -0
- model.pkl +3 -0
- requirements.txt +2 -0
README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
---
|
2 |
-
title: Snake Classification
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: gradio
|
7 |
sdk_version: 3.24.1
|
8 |
app_file: app.py
|
@@ -10,4 +10,10 @@ pinned: false
|
|
10 |
license: apache-2.0
|
11 |
---
|
12 |
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
title: Basic Snake Classification
|
3 |
+
emoji: 🔥
|
4 |
+
colorFrom: dark-blue
|
5 |
+
colorTo: light-pink
|
6 |
sdk: gradio
|
7 |
sdk_version: 3.24.1
|
8 |
app_file: app.py
|
|
|
10 |
license: apache-2.0
|
11 |
---
|
12 |
|
13 |
+
This is a basic snake classification model.
|
14 |
+
|
15 |
+
Built by fine-tuning the Levit 256 and using the "Identifying the different breeds of Snakes" (https://www.kaggle.com/datasets/duttadebadri/identifying-different-breeds-of-snakes) dataset on Kaggle.
|
16 |
+
|
17 |
+
The notebook used for training the model can be found at: https://www.kaggle.com/code/utkmal/snake-breeds-classifier-using-fast-ai
|
18 |
+
|
19 |
+
(Built by following the lessons 1 and 2 tutorial of FastAI)
|
app.py
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
+
|
4 |
+
# Converting Unix Path to Windows Path
|
5 |
+
import pathlib
|
6 |
+
pathlib.PosixPath = pathlib.WindowsPath
|
7 |
+
|
8 |
+
# Importing the model
|
9 |
+
model = load_learner('model.pkl')
|
10 |
+
|
11 |
+
categories = model.dls.vocab
|
12 |
+
|
13 |
+
def predict_snake_type(img):
|
14 |
+
snake_type, idx, probs = model.predict(img)
|
15 |
+
return dict(zip(categories, map(float, probs)))
|
16 |
+
|
17 |
+
# Gradio Interface
|
18 |
+
input_img = gr.Image()
|
19 |
+
outputs = gr.Label(num_top_classes=5)
|
20 |
+
|
21 |
+
gr.Interface(
|
22 |
+
fn=predict_snake_type,
|
23 |
+
inputs=[input_img], outputs=outputs,
|
24 |
+
examples=[
|
25 |
+
'examples/agkistrodon-contortrix.jpg',
|
26 |
+
'examples/haldea-striatula.jpg',
|
27 |
+
'examples/masticophis-flagellum.jpg',
|
28 |
+
'examples/storeria-occipitomaculata.jpg'
|
29 |
+
],
|
30 |
+
title='Classifying Different Breeds of snakes',
|
31 |
+
description='This is a multi-classification model that identifies different breeds of snakes.\nPlease note that is model is only `74%` accurate.'
|
32 |
+
).launch()
|
examples/agkistrodon-contortrix.jpg
ADDED
examples/haldea-striatula.jpg
ADDED
examples/masticophis-flagellum.jpg
ADDED
examples/storeria-occipitomaculata.jpg
ADDED
model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9a290f583373e743bb32ea8597b494c73fb34cd05063195f400d11f06aff0d3f
|
3 |
+
size 78069633
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
fastai
|
2 |
+
gradio
|