prashkh commited on
Commit
8103dd1
·
1 Parent(s): 079c7e5

Upload 5 files

Browse files
Files changed (6) hide show
  1. .gitattributes +1 -0
  2. app.py +27 -4
  3. cat.jpg +3 -0
  4. dog.jpg +0 -0
  5. dunno.jpg +0 -0
  6. model.pkl +3 -0
.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
+ cat.jpg filter=lfs diff=lfs merge=lfs -text
app.py CHANGED
@@ -1,7 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
1
+ # import gradio as gr
2
+
3
+ # def greet(name):
4
+ # return "Hello " + name + "!!"
5
+
6
+ # iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
+ # iface.launch()
8
+
9
+ __all__ = ['is_cat', 'learn', 'classify_image', 'categories', 'image', 'label', 'examples', 'intf']
10
+
11
+ from fastai.vision.all import *
12
  import gradio as gr
13
 
14
+ def is_cat(x): return x[0].isupper()
15
+
16
+ learn = load_learner('model.pkl')
17
+
18
+ categories = ('Dog', 'Cat')
19
+
20
+ def classify_image(img):
21
+ pred, idx, probs = learn.predict(img)
22
+ return dict(zip(categories, map(float, probs)))
23
+
24
+
25
+ image = gr.inputs.Image(shape=(192,192))
26
+ label = gr.outputs.Label()
27
+ examples = ['dog.jpg', 'dunno.jpg']
28
 
29
+ intf = gr.Interface(fn = classify_image, inputs = image, outputs = label, examples = examples)
30
+ intf.launch(inline=False)
cat.jpg ADDED

Git LFS Details

  • SHA256: 1c9cd40b037bbac4f4b236de657bab130200bb037c5df01372cc72b10144d7ab
  • Pointer size: 132 Bytes
  • Size of remote file: 1.16 MB
dog.jpg ADDED
dunno.jpg ADDED
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:40e126b3268cf7ec58ab8e50c08349a276de978df642e291ce9d2b854036fce2
3
+ size 47064766