martinmorando commited on
Commit
b74e56c
·
1 Parent(s): 66d8c9d

add initial version

Browse files
Files changed (7) hide show
  1. .gitattributes +3 -0
  2. README.md +6 -0
  3. app.py +17 -0
  4. examples/airplane.jpg +3 -0
  5. examples/tree.jpg +3 -0
  6. export.pkl +3 -0
  7. requirements.txt +1 -0
.gitattributes CHANGED
@@ -33,3 +33,6 @@ 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
+ export.pkl filter=lfs diff=lfs merge=lfs -text
37
+ examples/airplane.jpg filter=lfs diff=lfs merge=lfs -text
38
+ examples/tree.jpg filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -12,3 +12,9 @@ short_description: Tree detector
12
  ---
13
 
14
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
12
  ---
13
 
14
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
15
+
16
+
17
+ ## Image credits
18
+ - `tree.jpg`: https://commons.wikimedia.org/wiki/File:Flooded_Albizia_Saman_(rain_tree)_in_the_Mekong.jpg. Basile Morin, CC BY-SA 4.0 <https://creativecommons.org/licenses/by-sa/4.0>, via Wikimedia Commons.
19
+
20
+ - `airplane.jpg`: https://commons.wikimedia.org/wiki/File:Emirates_Airbus_A380-861_A6-EER_MUC_2015_01.jpg. Julian Herzog, CC BY 4.0 <https://creativecommons.org/licenses/by/4.0>, via Wikimedia Commons.
app.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastai.vision.all import *
2
+ import gradio as gr
3
+
4
+ learn = load_learner("export.pkl")
5
+
6
+ categories = ("Airplane", "Tree")
7
+
8
+ base_path = "examples/"
9
+ examples = ["tree.jpg", "airplane.jpg"]
10
+ examples = [base_path + filename for filename in examples]
11
+
12
+ def classify_image(img):
13
+ pred,idx,probs = learn.predict(img)
14
+ return dict(zip(categories, map(float,probs)))
15
+
16
+ demo = gr.Interface(fn=classify_image, inputs="image", outputs="text", examples=examples, live=True)
17
+ demo.launch()
examples/airplane.jpg ADDED

Git LFS Details

  • SHA256: 3704eea2ef79651303364a2f6001bce0e05871df67c3fa0f6095392790d96a76
  • Pointer size: 130 Bytes
  • Size of remote file: 26.6 kB
examples/tree.jpg ADDED

Git LFS Details

  • SHA256: 5ec91b21e8e28badea7541fe24f934bb6f0a503d0efd0a51486025eb6a7da58f
  • Pointer size: 130 Bytes
  • Size of remote file: 73.1 kB
export.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:baeeb0d29b54329c0b4cd5657d5a9e5448eba6c6d0270d6e509340b3ea88fdfb
3
+ size 46961549
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ fastai==2.7.19