nkhimin commited on
Commit
2bed28e
β€’
1 Parent(s): a33b47a
.DS_Store ADDED
Binary file (6.15 kB). View file
 
.gitattributes CHANGED
@@ -33,3 +33,5 @@ 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
+ *.png filter=lfs diff=lfs merge=lfs -text
37
+ *.jpg filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -1,13 +1,12 @@
1
  ---
2
  title: Pet Classifier
3
- emoji: πŸ“Š
4
- colorFrom: red
5
- colorTo: blue
6
  sdk: gradio
7
  sdk_version: 4.27.0
8
  app_file: app.py
9
  pinned: false
10
- license: apache-2.0
11
  ---
12
 
13
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
  title: Pet Classifier
3
+ emoji: πŸ“‰
4
+ colorFrom: purple
5
+ colorTo: gray
6
  sdk: gradio
7
  sdk_version: 4.27.0
8
  app_file: app.py
9
  pinned: false
 
10
  ---
11
 
12
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from pathlib import Path
3
+ # from fastai.vision.all import * # noqa: F403
4
+ from fastai.learner import load_learner
5
+ from fastai.vision.core import PILImage
6
+ import os
7
+
8
+
9
+ # import skimage
10
+
11
+
12
+ # Define any custom functions or classes that the model depends on
13
+ def is_cat(x): # Make sure to define this correctly as it was used during training
14
+ return x[0].isupper()
15
+
16
+ print(os.path.abspath("model-export.pkl"))
17
+ learn = load_learner("model-export.pkl")
18
+
19
+ labels = learn.dls.vocab
20
+
21
+
22
+ def predict(img):
23
+ img = PILImage.create(img)
24
+ pred, pred_idx, probs = learn.predict(img)
25
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
26
+
27
+
28
+ title = "Pet Breed Classifier"
29
+ description = "A pet breed classifier trained on the Oxford Pets dataset with fastai. Created as a demo for Gradio and HuggingFace Spaces."
30
+ article = "<p style='text-align: center'><a href='https://tmabraham.github.io/blog/gradio_hf_spaces_tutorial' target='_blank'>Blog post</a></p>"
31
+ path = Path('examples')
32
+ examples = list(path.iterdir())
33
+
34
+ gr.Interface(
35
+ fn=predict,
36
+ inputs="image",
37
+ outputs="label",
38
+ title=title,
39
+ description=description,
40
+ article=article,
41
+ examples=examples
42
+ ).launch()
43
+
44
+
examples/.DS_Store ADDED
Binary file (6.15 kB). View file
 
examples/10.png ADDED

Git LFS Details

  • SHA256: 7e6700b386987b258245b0794d3728600a2038621a0cef94da7c11bf19333dcc
  • Pointer size: 132 Bytes
  • Size of remote file: 1.7 MB
examples/11.png ADDED

Git LFS Details

  • SHA256: 487c2275a79095e795f7c7fa0d835534d02a3d147aeb2cf28be34f7648a493ee
  • Pointer size: 132 Bytes
  • Size of remote file: 2.38 MB
examples/2.png ADDED

Git LFS Details

  • SHA256: b5002a557558bba8c7509a87b59ac522618f228a9b8c2c4a1580f660f80eb75a
  • Pointer size: 132 Bytes
  • Size of remote file: 5.98 MB
examples/British_Shorthair.png ADDED

Git LFS Details

  • SHA256: 9c934e65e106998a8bd6966e09a4013b742a8fd4a3464cf427e493711f947bd1
  • Pointer size: 131 Bytes
  • Size of remote file: 194 kB
examples/dachshund.jpg ADDED

Git LFS Details

  • SHA256: 9ea058ee1a571f702b765f862191e82eff1a9d8d3a7a34d14f49fae4588a0fa5
  • Pointer size: 130 Bytes
  • Size of remote file: 78.3 kB
examples/pomeranian.png ADDED

Git LFS Details

  • SHA256: b56c9e33c2dd601c42661becf7bd9c88e0d35eb7b0ccbc0e95da6dab7cbcc766
  • Pointer size: 131 Bytes
  • Size of remote file: 681 kB
examples/siamese.png ADDED

Git LFS Details

  • SHA256: b7cfd7b51ded9ec2933242d674e6b4150908a85d150b04fe8a7ebce403c52d82
  • Pointer size: 131 Bytes
  • Size of remote file: 984 kB
examples/toy_poodle.png ADDED

Git LFS Details

  • SHA256: 4c87a5a1be66186713797772243bcfe2f96d38735c5700b70e6b4dbd799d0ea3
  • Pointer size: 131 Bytes
  • Size of remote file: 589 kB
model-export.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:31ce20b2b77e13cc4cbf4014dab953ea42f8c3a626a6983f62a76f3b3a55ff2c
3
+ size 47072792
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ gradio==4.27
2
+ fastai==2.7.14
3
+ scikit-image==0.22