arikru commited on
Commit
ad75c93
1 Parent(s): d53fffc
Files changed (2) hide show
  1. .gitattributes +2 -0
  2. app.py +27 -4
.gitattributes CHANGED
@@ -33,3 +33,5 @@ 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
+ .jpg filter=lfs diff=lfs merge=lfs -text
37
+ *.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
+ # AUTOGENERATED! DO NOT EDIT! File to edit: app.ipynb.
2
+
3
+ # %% auto 0
4
+ __all__ = ['learn', 'categories', 'im', 'image', 'label', 'examples', 'intf', 'classify_image']
5
+
6
+ # %% app.ipynb 1
7
+ from fastai.vision.all import *
8
  import gradio as gr
9
 
10
+ # %% app.ipynb 2
11
+ learn = load_learner('export.pkl')
12
+
13
+ # %% app.ipynb 7
14
+ categories = ('dreckig', 'sauber')
15
+ im = PILImage.create('packstation_sauber.jpg')
16
+ im.thumbnail((192,192))
17
+ im
18
+
19
+ learn.predict(im)
20
+ def classify_image(img):
21
+ prod,idx,probs = learn.predict(img)
22
+ return dict(zip(categories, map(float,probs)))
23
+
24
+ # %% app.ipynb 9
25
+ image = gr.inputs.Image(shape=(192,192))
26
+ label = gr.outputs.Label()
27
+ examples = ['packstation_sauber.jpg', 'packstation_dreckig.jpg']
28
 
29
+ intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
30
+ intf.launch(inline=False)