programx360 commited on
Commit
a26f689
·
1 Parent(s): 2efd30a

Initial commit

Browse files
Files changed (4) hide show
  1. README.md +5 -4
  2. app.py +20 -0
  3. cat.jpg +0 -0
  4. model.pkl +3 -0
README.md CHANGED
@@ -1,12 +1,13 @@
1
  ---
2
- title: Fastai Chapter2 V2
3
- emoji: 👀
4
- colorFrom: pink
5
- colorTo: gray
6
  sdk: gradio
7
  sdk_version: 5.25.2
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
 
1
  ---
2
+ title: Fastai Chapter2
3
+ emoji: 🦀
4
+ colorFrom: purple
5
+ colorTo: indigo
6
  sdk: gradio
7
  sdk_version: 5.25.2
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
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastai.vision.all import *
2
+ import gradio as gr
3
+
4
+ def is_cat(x): return x[0].isupper()
5
+
6
+ learn = load_learner('model.pkl')
7
+
8
+ categories = ('Dog','Cat')
9
+
10
+ def classify_image(img)
11
+ pred,idx,probs = learn.predict(img)
12
+ return dict(zip(categories, map(float,probs)))
13
+
14
+ image = gr.inputs.Image(shape=(192,92))
15
+ label = gr.outputs.Label()
16
+ examples = ['cat.jpg']
17
+
18
+ intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
19
+ intf.launch(inline=False)
20
+
cat.jpg ADDED
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:654a2de9dc82bf473caea2146775a0f013da4a2a68a35fd9f27269810a178035
3
+ size 47066878