harishvs commited on
Commit
398e7c5
·
1 Parent(s): 7593d97
Files changed (6) hide show
  1. .gitattributes +1 -0
  2. app.py +20 -4
  3. black.jpg +0 -0
  4. export.pkl +3 -0
  5. grizzly.jpg +0 -0
  6. teddy.jpg +3 -0
.gitattributes CHANGED
@@ -32,3 +32,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
32
  *.zip filter=lfs diff=lfs merge=lfs -text
33
  *.zst filter=lfs diff=lfs merge=lfs -text
34
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
32
  *.zip filter=lfs diff=lfs merge=lfs -text
33
  *.zst filter=lfs diff=lfs merge=lfs -text
34
  *tfevents* filter=lfs diff=lfs merge=lfs -text
35
+ teddy.jpg filter=lfs diff=lfs merge=lfs -text
app.py CHANGED
@@ -1,7 +1,23 @@
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
+ from fastai.vision.all import load_learner
3
 
 
 
4
 
5
+ learn = load_learner("export.pkl")
6
+ categories = ("black", "grizzly", "teddy")
7
+
8
+
9
+ def classify_image(img):
10
+ _, _, probs = learn.predict(img)
11
+ return dict(zip(categories, map(float, probs)))
12
+
13
+
14
+ image = gr.inputs.Image(shape=(192, 192))
15
+ label = gr.outputs.Label()
16
+ examples = ["black.jpg", "grizzly.jpg", "teddy.jpg"]
17
+
18
+
19
+ iface = gr.Interface(
20
+ fn=classify_image, inputs="image", outputs="text", examples=examples
21
+ )
22
+
23
+ iface.launch()
black.jpg ADDED
export.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1430401378b0e62976af41193f7158305a594e03c1aea1c804fc39ff879e2e3e
3
+ size 46965327
grizzly.jpg ADDED
teddy.jpg ADDED

Git LFS Details

  • SHA256: 291b59133a24bcb6e474b4f8009e2d247bdf50154a255405c01ad05a3921877b
  • Pointer size: 132 Bytes
  • Size of remote file: 1.76 MB