nahid22 commited on
Commit
6cc88ca
1 Parent(s): f99c195

Upload 16 files

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ test_images/unknown_flower_04.jpg filter=lfs diff=lfs merge=lfs -text
app.py ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ """Flower-recognition-app.ipynb
3
+
4
+ Automatically generated by Colaboratory.
5
+
6
+ Original file is located at
7
+ https://colab.research.google.com/drive/1Oxv1S-3SmLY0i0vKtlsduK8RVcj4EccJ
8
+ """
9
+
10
+ # Commented out IPython magic to ensure Python compatibility.
11
+ # %reload_ext autoreload
12
+ # %autoreload 2
13
+ # %matplotlib inline
14
+ bs = 32 # batch size
15
+
16
+ version = 2
17
+
18
+ # Installing all 3 libraries in one go: fastai, fastbook, nbdev
19
+ #!pip install -Uqq fastai fastbook nbdev
20
+
21
+ #!pip install gradio==3.50.0
22
+
23
+ from fastai import *
24
+ #from fastbook import *
25
+ from fastai.vision.all import *
26
+
27
+ import pathlib
28
+ temp = pathlib.PosixPath
29
+ pathlib.PosixPath = pathlib.WindowsPath
30
+
31
+ # Commented out IPython magic to ensure Python compatibility.
32
+ # %cd /content/drive/My Drive/Mastercourse/Flower recognizer
33
+
34
+ flower_labels = [
35
+ 'Beli flower',
36
+ 'Gada flower',
37
+ 'Joba flower',
38
+ 'Kamini flower',
39
+ 'Kodom flower',
40
+ 'Palash flower',
41
+ 'Rose flower',
42
+ 'Sheuli flower',
43
+ 'Sunflower flower',
44
+ 'Water Lily'
45
+ ]
46
+
47
+ img_path = 'test_images'
48
+ model_path = f'models/flower-recognizer-v{version}.pkl'
49
+
50
+ #load the model from the pickle file
51
+ model = load_learner(model_path)
52
+
53
+ # Defining a function to recognize an image
54
+ def recognize_image(image):
55
+ pred, idx, probs = model.predict(image)
56
+ return dict(zip(flower_labels, map(float, probs)))
57
+
58
+ img = PILImage.create(f'test_images/unknown_flower_00.jpg')
59
+ img.thumbnail((192,192))
60
+ img
61
+
62
+ recognize_image(img)
63
+
64
+ import gradio as gr
65
+
66
+ image = gr.inputs.Image(shape=(192,192))
67
+ label = gr.outputs.Label()
68
+ examples = [
69
+ 'test_images/unknown_flower_00.jpg',
70
+ 'test_images/unknown_flower_01.jpg',
71
+ 'test_images/unknown_flower_02.jpg',
72
+ 'test_images/unknown_flower_03.jpg',
73
+ 'test_images/unknown_flower_04.jpg',
74
+ 'test_images/unknown_flower_05.jpg',
75
+ ]
76
+
77
+ iface = gr.Interface(fn=recognize_image, inputs=image, outputs=label, examples=examples)
78
+ iface.launch(share=True)
flower_dataloader_v0.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3a4f6880f1a67cf807a0a5599e304b11ea7421ad86bebeffad440bbe2aaf4f01
3
+ size 182593
flower_dataloader_v1.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ebb0e80675be3896bf07fd400e114550a6e05e7d7ff7f655e57e0d9e81a13629
3
+ size 182593
flower_dataloader_v2.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:be04335586c84b6480ff1e7b8c747681d61523b913cdd64dd7f1ee3eb457a43b
3
+ size 182465
models/cap-recognizer-v0.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:96c02840e9bc865706aedbc2bbbf44fcafb5179003cef05977dbc5ebe9402181
3
+ size 262034138
models/flower-recognizer-v0.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6f7625288d3c40610a3e6e033861cff3d7815de4d086d9c75b26047b3040526e
3
+ size 262029182
models/flower-recognizer-v1.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:05b43b02c46b494d9f0da5268c6eb736e057b3139274075104c01e8027470bf2
3
+ size 262035518
models/flower-recognizer-v2.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8097cd80e4ba487b0dfb9b0c55c4d51826ca31c39da4fbdc97fc3ebc3e3f21ae
3
+ size 87526529
models/flower-recognizer-v2.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0ac4ad5ad02d498c1c07ebe51a14b3dcbd16252ff240ee801e4638b27398a5e9
3
+ size 262035518
requirements.txt ADDED
Binary file (62 Bytes). View file
 
test_images/unknown_flower_00.jpg ADDED
test_images/unknown_flower_01.jpg ADDED
test_images/unknown_flower_02.jpg ADDED
test_images/unknown_flower_03.jpg ADDED
test_images/unknown_flower_04.jpg ADDED

Git LFS Details

  • SHA256: dc1e1352bccaf0958833baaf0da1e9eea32a083da9989d2b828bbac3ca2ec46a
  • Pointer size: 132 Bytes
  • Size of remote file: 1.09 MB
test_images/unknown_flower_05.jpg ADDED