Noah Losch commited on
Commit
f28519e
·
1 Parent(s): ae7ae96

add models, examples and app

Browse files
Chicago school architecture.jpeg ADDED
Deconstructivism.jpeg ADDED
Gothic architecture.jpeg ADDED
app.py ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # AUTOGENERATED! DO NOT EDIT! File to edit: app.ipynb.
2
+
3
+ # %% auto 0
4
+ __all__ = ['learn', 'cloud_types', 'image', 'label', 'examples', 'intf', 'classify_image']
5
+
6
+ # %% app.ipynb 2
7
+ from fastai.vision.all import *
8
+ import gradio as gr
9
+
10
+ # %% app.ipynb 3
11
+ learn = load_learner('models/architecture_style_classifyier_levit_384_model.pkl')
12
+
13
+ # %% app.ipynb 4
14
+ architecture_styles = [
15
+ 'Achaemenid architecture',
16
+ 'American craftsman style',
17
+ 'American Foursquare architecture',
18
+ 'Ancient Egyptian architecture',
19
+ 'Art Deco architecture',
20
+ 'Art Nouveau architecture',
21
+ 'Baroque architecture',
22
+ 'Bauhaus architecture',
23
+ 'Beaux-Arts architecture',
24
+ 'Byzantine architecture',
25
+ 'Chicago school architecture',
26
+ 'Colonial architecture',
27
+ 'Deconstructivism',
28
+ 'Edwardian architecture',
29
+ 'Georgian architecture',
30
+ 'Gothic architecture',
31
+ 'Greek Revival architecture',
32
+ 'International style',
33
+ 'Novelty architecture',
34
+ 'Palladian architecture',
35
+ 'Postmodern architecture',
36
+ 'Queen Anne architecture',
37
+ 'Romanesque architecture',
38
+ 'Russian Revival architecture',
39
+ 'Tudor Revival architecture'
40
+ ]
41
+
42
+ def classify_image(img):
43
+ pred,idx,probs = learn.predict(img)
44
+ return dict(zip(architecture_styles, map(float, probs)))
45
+
46
+ # %% app.ipynb 6
47
+ image = gr.inputs.Image(shape=(192,192))
48
+ label = gr.outputs.Label()
49
+ examples = ['Chicago school architecture.jpeg', 'Deconstructivism.jpeg', 'Gothic architecture.jpeg']
50
+
51
+ intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
52
+ intf.launch(inline=False)
models/architecture_style_classifyier_levit_384_model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:511a72baa6a1dd8d93397019ea104918b3b531ff3fc505bfa63cfa653bb53d1c
3
+ size 154291159
models/architecture_style_classifyier_resnet18_model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f857b17737564dd0daadc965cfd1a89f4f7edb535ce50dba9b832d51cce14ab3
3
+ size 47239117