arafat2345 commited on
Commit
08d8799
·
verified ·
1 Parent(s): f9e239c

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -47
app.py DELETED
@@ -1,47 +0,0 @@
1
- from fastai.vision.all import *
2
- import gradio as gr
3
-
4
- # import pathlib
5
- # temp = pathlib.PosixPath
6
- # pathlib.PosixPath = pathlib.WindowsPath
7
-
8
- cap_labels = (
9
- 'balaclava cap',
10
- 'baseball cap',
11
- 'beanie cap',
12
- 'boater hat',
13
- 'bowler hat',
14
- 'bucket hat',
15
- 'cowboy hat',
16
- 'fedora cap',
17
- 'flat cap',
18
- 'ivy cap',
19
- 'kepi cap',
20
- 'newsboy cap',
21
- 'pork pie hat',
22
- 'rasta cap',
23
- 'sun hat',
24
- 'taqiyah cap',
25
- 'top hat',
26
- 'trucker cap',
27
- 'turban cap',
28
- 'visor cap'
29
- )
30
-
31
- model = load_learner('cap-recognizer-v2.pkl')
32
-
33
- def recognize_image(image):
34
- pred, idx, probs = model.predict(image)
35
- return dict(zip(cap_labels, map(float, probs)))
36
-
37
- image = gr.inputs.Image(shape=(192,192))
38
- label = gr.outputs.Label(num_top_classes=5)
39
- examples = [
40
- 'unknown_00.jpg',
41
- 'unknown_01.jpg',
42
- 'unknown_02.jpg',
43
- 'unknown_03.jpg'
44
- ]
45
-
46
- iface = gr.Interface(fn=recognize_image, inputs=image, outputs=label, examples=examples)
47
- iface.launch(inline=False)