dhinman commited on
Commit
52d0c5c
1 Parent(s): 3dfa0d8

Initial commit; trying to get all the binary files up there

Browse files
Files changed (6) hide show
  1. .gitattributes +1 -0
  2. app.py +27 -0
  3. black.jpg +3 -0
  4. grizzly.jpg +3 -0
  5. model.pkl +3 -0
  6. requirements.txt +2 -0
.gitattributes CHANGED
@@ -31,3 +31,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
31
  *.zip filter=lfs diff=lfs merge=lfs -text
32
  *.zst filter=lfs diff=lfs merge=lfs -text
33
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
31
  *.zip filter=lfs diff=lfs merge=lfs -text
32
  *.zst filter=lfs diff=lfs merge=lfs -text
33
  *tfevents* filter=lfs diff=lfs merge=lfs -text
34
+ *.jpg filter=lfs diff=lfs merge=lfs -text
app.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # AUTOGENERATED! DO NOT EDIT! File to edit: Lesson02.ipynb.
2
+
3
+ # %% auto 0
4
+ __all__ = ['learn', 'categories', 'title', 'description', 'image', 'label', 'examples', 'intf', 'classify_image']
5
+
6
+ # %% Lesson02.ipynb 14
7
+ from fastai.vision.all import *
8
+ import gradio as gr
9
+
10
+ learn = load_learner('model.pkl')
11
+
12
+ categories = ('black', 'grizzly', 'panda', 'sloth', 'teddy')
13
+
14
+ def classify_image(img):
15
+ pred, idx, probs = learn.predict(img)
16
+ return dict(zip(categories, map(float, probs)))
17
+
18
+ title = "Bear discriminator"
19
+ description = "Identify different types of bears with fastai. Created as a demo for Gradio and HuggingFace Spaces."
20
+
21
+ image = gr.inputs.Image(shape=(192,192))
22
+ label = gr.outputs.Label()
23
+ examples = ['grizzly.jpg', 'black.jpg']
24
+
25
+ intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples,
26
+ title=title, description=description)
27
+ intf.launch(inline=False)
black.jpg ADDED

Git LFS Details

  • SHA256: c0e2c6ff60b9a0ef00aad8986f3ae0b5140936a48fa63ae799cdc5d4ffad9ae2
  • Pointer size: 130 Bytes
  • Size of remote file: 31 kB
grizzly.jpg ADDED

Git LFS Details

  • SHA256: 73ba66152f92e2c0d93c593eeb4bf188c0d6f8d1e02d8c65156c5ef3a06f8ddd
  • Pointer size: 132 Bytes
  • Size of remote file: 1.32 MB
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:54cc6d88bec8566cda81645a7fa16b7e00bf72e531b4b062fbaad68ab763f748
3
+ size 46976929
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ fastai
2
+ scikit-image