inigogab commited on
Commit
5e9f943
·
1 Parent(s): c97869c

Initial model deploy

Browse files
.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
+ *.png filter=lfs diff=lfs merge=lfs -text
app.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ __all__ = ["examples", "iface", "learn", "labels", "classify_bear", "bear_image", "outputs"]
2
+
3
+ import gradio as gr
4
+ from fastai.vision.all import *
5
+ from fastcore.all import *
6
+
7
+ learn = load_learner("model/export.pkl")
8
+ labels = learn.dls.vocab
9
+
10
+ examples = [
11
+ "examples/black.jpg",
12
+ "examples/grizzly.jpg",
13
+ "examples/panda.jpg",
14
+ "examples/polar.jpg",
15
+ "examples/teddy.png"
16
+ ]
17
+
18
+ def classify_bear(img):
19
+ img = PILImage.create(img)
20
+ pred,idx,probs = learn.predict(img)
21
+ return f"Prediction: {pred}; Probability: {probs[idx]:.04f}"
22
+
23
+ bear_image = gr.inputs.Image(shape=(192,192))
24
+ outputs = gr.outputs.Label(num_top_classes=5)
25
+
26
+ # App launch
27
+ iface = gr.Interface(
28
+ fn=classify_bear, inputs=bear_image, outputs=outputs, examples=examples)
29
+ iface.launch()
examples/black.jpg ADDED
examples/grizzly.jpg ADDED
examples/panda.jpg ADDED
examples/polar.jpg ADDED
examples/teddy.png ADDED

Git LFS Details

  • SHA256: d1e052c5e8710ee3c6c9010d1b75faba912d62ff5e800382a6b93e348b6f7abc
  • Pointer size: 132 Bytes
  • Size of remote file: 1.99 MB
model/export.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a0ee9de9b98fb51d0eb0622519c54e6ae54be04b85f2e35560f6056cfde33f24
3
+ size 46973985
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ fastai
2
+ scikit-image
3
+ gradio