Abyszero commited on
Commit
b45f56d
1 Parent(s): fed1100
Files changed (2) hide show
  1. README.md +1 -1
  2. app.py +19 -9
README.md CHANGED
@@ -1,7 +1,7 @@
1
  ---
2
  title: Multilabel Classification
3
  sdk: gradio
4
- app_file: petdector/core.py
5
  pinned: false
6
  ---
7
 
 
1
  ---
2
  title: Multilabel Classification
3
  sdk: gradio
4
+ app_file: app.y
5
  pinned: false
6
  ---
7
 
app.py CHANGED
@@ -1,17 +1,27 @@
1
- import gradio as gr
 
 
 
 
 
2
  from fastai.vision.all import *
3
 
4
- def is_cat(x): return x[0].isupper()
5
- categories = ('cat', 'dog')
6
- learn = load_learner('model.pkl')
7
 
 
 
 
 
 
 
8
  def classify_image(img):
9
- pred, idx, probs = learn.predict(img)
10
  return dict(zip(categories, map(float, probs)))
11
 
12
- image = gr.inputs.Image(shape=(192, 192))
13
  label = gr.outputs.Label()
14
- examples = []
15
 
16
- iface = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
17
- iface.launch(inline=False)
 
1
+ # AUTOGENERATED! DO NOT EDIT! File to edit: ../00_core.ipynb.
2
+
3
+ # %% auto 0
4
+ __all__ = ['learn_inf', 'categories', 'image', 'label', 'examples', 'intf', 'classify_image']
5
+
6
+ # %% ../00_core.ipynb 3
7
  from fastai.vision.all import *
8
 
9
+ # %% ../00_core.ipynb 17
10
+ learn_inf = load_learner('export.pkl')
 
11
 
12
+ # %% ../00_core.ipynb 21
13
+ import gradio as gr
14
+ categories = ['aeroplane', 'bicycle', 'bird', 'boat', 'bottle',
15
+ 'bus', 'car', 'cat', 'chair', 'cow', 'diningtable', 'dog',
16
+ 'horse', 'motorbike', 'person', 'pottedplant', 'sheep',
17
+ 'sofa', 'train', 'tvmonitor']
18
  def classify_image(img):
19
+ red, idx, probs = learn_inf.predict(img)
20
  return dict(zip(categories, map(float, probs)))
21
 
22
+ image = gr.inputs.Image(shape=(192,192))
23
  label = gr.outputs.Label()
24
+ examples = ['sheep.PNG', 'chair_diningtable.PNG', 'car_person.PNG']
25
 
26
+ intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
27
+ intf.launch(inline=False)