nelbarman053
commited on
Commit
•
8729dde
1
Parent(s):
9f3c4f1
Initial Complete Deployment
Browse files- app.py +54 -0
- models/recgonizer_model.pkl +3 -0
- requirements.txt +0 -0
- test images/unknown_01.jpg +0 -0
- test images/unknown_02.png +0 -0
- test images/unknown_03.jpg +0 -0
- test images/unknown_04.jpg +0 -0
- test images/unknown_05.jpg +0 -0
- test images/unknown_06.jpg +0 -0
- test images/unknown_07.jpg +0 -0
- test images/unknown_08.jpg +0 -0
- test images/unknown_09.jpg +0 -0
- test images/unknown_10.jpg +0 -0
- test images/unknown_11.jpg +0 -0
app.py
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# -*- coding: utf-8 -*-
|
2 |
+
"""app creation.ipynb
|
3 |
+
|
4 |
+
Automatically generated by Colaboratory.
|
5 |
+
|
6 |
+
Original file is located at
|
7 |
+
https://colab.research.google.com/drive/1c8HIdMTAJxhNiPY7_kmzP78yFiwdhh8Q
|
8 |
+
"""
|
9 |
+
|
10 |
+
import gradio as gr
|
11 |
+
from fastai import *
|
12 |
+
from fastai.vision.all import *
|
13 |
+
|
14 |
+
import pathlib
|
15 |
+
temp = pathlib.PosixPath
|
16 |
+
pathlib.PosixPath = pathlib.WindowsPath
|
17 |
+
|
18 |
+
model = load_learner("models/recgonizer_model.pkl")
|
19 |
+
|
20 |
+
labels = ['Ayre', 'Catla', 'Chital', 'Ilish', 'Kachki', 'Kajoli', 'Koi', 'Magur', 'Mola Dhela', 'Mrigal', 'Pabda', 'Pangash', 'Poa', 'Puti', 'Rui', 'Shing', 'Silver Carp', 'Taki', 'Telapia', 'Tengra']
|
21 |
+
|
22 |
+
def recognize_image(image_path):
|
23 |
+
label, _, probs = model.predict(image_path)
|
24 |
+
return dict(zip(labels, map(float, probs)))
|
25 |
+
|
26 |
+
inputs = gr.Image()
|
27 |
+
outputs = gr.Label()
|
28 |
+
|
29 |
+
examples = [
|
30 |
+
'test images/unknown_01.jpg',
|
31 |
+
'test images/unknown_02.png',
|
32 |
+
'test images/unknown_03.jpg',
|
33 |
+
'test images/unknown_04.jpg',
|
34 |
+
'test images/unknown_05.jpg',
|
35 |
+
'test images/unknown_06.jpg',
|
36 |
+
'test images/unknown_07.jpg',
|
37 |
+
'test images/unknown_08.jpg',
|
38 |
+
'test images/unknown_09.jpg',
|
39 |
+
'test images/unknown_10.jpg',
|
40 |
+
'test images/unknown_11.jpg',
|
41 |
+
]
|
42 |
+
|
43 |
+
interface = gr.Interface(fn=recognize_image, inputs = inputs, outputs=outputs, examples = examples)
|
44 |
+
|
45 |
+
interface.launch(debug=True, share=True)
|
46 |
+
|
47 |
+
|
48 |
+
|
49 |
+
|
50 |
+
|
51 |
+
|
52 |
+
|
53 |
+
|
54 |
+
|
models/recgonizer_model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ffd3e4d01b67849eb16313b25a41d0ef9750c81be86682dc40bfa082d82da8c3
|
3 |
+
size 82557344
|
requirements.txt
ADDED
Binary file (64 Bytes). View file
|
|
test images/unknown_01.jpg
ADDED
test images/unknown_02.png
ADDED
test images/unknown_03.jpg
ADDED
test images/unknown_04.jpg
ADDED
test images/unknown_05.jpg
ADDED
test images/unknown_06.jpg
ADDED
test images/unknown_07.jpg
ADDED
test images/unknown_08.jpg
ADDED
test images/unknown_09.jpg
ADDED
test images/unknown_10.jpg
ADDED
test images/unknown_11.jpg
ADDED