ludjan commited on
Commit
39e19f6
·
verified ·
1 Parent(s): 120510d

Delete app.py

Browse files

Remove old app.py

Files changed (1) hide show
  1. app.py +0 -32
app.py DELETED
@@ -1,32 +0,0 @@
1
- __all__ = ['learn', 'categories', 'examples', 'image', 'label', 'intf', 'classify_image']
2
-
3
- from fastai.vision.all import *
4
- import gradio as gr
5
- import timm
6
-
7
- # the get_y function
8
- def has_tori_logo_parent(o):
9
- p = Path(o).parent.name
10
- return p == 'tori-logo'
11
-
12
- learn = load_learner('tori-model.pkl')
13
-
14
- categories = ['Something else', 'Tori logo']
15
-
16
- def classify_image(img):
17
- is_tori_logo, idx, probs = learn.predict(img)
18
- return dict(zip(categories, map(float,probs)))
19
-
20
- examples = [
21
- 'images/dog.jpeg',
22
- 'images/cat.jpeg',
23
- 'images/face.jpg',
24
- 'images/profile-avatar.jpeg',
25
- 'images/tori-logo.png'
26
- ]
27
-
28
- image = gr.Image()
29
- label = gr.Label()
30
-
31
- intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
32
- intf.launch()