Spaces:
Sleeping
Sleeping
Commit
·
c98afd9
1
Parent(s):
f71d400
Initial Commit
Browse files- app.py +41 -0
- architecturemodel.pkl +3 -0
- bigben.jpeg +0 -0
- pyramid.jpeg +0 -0
- requirements.txt +1 -0
- robiehouse.jpeg +0 -0
- train.ipynb +0 -0
app.py
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastai.vision.all import *
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
learn = load_learner('architecturemodel.pkl')
|
5 |
+
|
6 |
+
categories = ('Achaemenid architecture',
|
7 |
+
'American Foursquare architecture',
|
8 |
+
'American craftsman style',
|
9 |
+
'Ancient Egyptian architecture',
|
10 |
+
'Art Deco architecture',
|
11 |
+
'Art Nouveau architecture',
|
12 |
+
'Baroque architecture',
|
13 |
+
'Bauhaus architecture',
|
14 |
+
'Beaux-Arts architecture',
|
15 |
+
'Byzantine architecture',
|
16 |
+
'Chicago school architecture',
|
17 |
+
'Colonial architecture',
|
18 |
+
'Deconstructivism',
|
19 |
+
'Edwardian architecture',
|
20 |
+
'Georgian architecture',
|
21 |
+
'Gothic architecture',
|
22 |
+
'Greek Revival architecture',
|
23 |
+
'International style',
|
24 |
+
'Novelty architecture',
|
25 |
+
'Palladian architecture',
|
26 |
+
'Postmodern architecture',
|
27 |
+
'Queen Anne architecture',
|
28 |
+
'Romanesque architecture',
|
29 |
+
'Russian Revival architecture',
|
30 |
+
'Tudor Revival architecture')
|
31 |
+
|
32 |
+
def classify_image(img):
|
33 |
+
pred,idx,probs = learn.predict(img)
|
34 |
+
return dict(zip(categories, map(float,probs)))
|
35 |
+
|
36 |
+
image = gr.inputs.Image(shape=(192, 192))
|
37 |
+
label = gr.outputs.Label()
|
38 |
+
examples = ['bigben.jpeg','pyramid.jpeg','robiehouse.jpeg']
|
39 |
+
|
40 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
41 |
+
intf.launch(inline=False, share=True)
|
architecturemodel.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c4d3283733f4e7648eebd6c3c73bfb00c6687b10b8a9f911a156106314787c08
|
3 |
+
size 87602593
|
bigben.jpeg
ADDED
![]() |
pyramid.jpeg
ADDED
![]() |
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
fastai
|
robiehouse.jpeg
ADDED
![]() |
train.ipynb
ADDED
The diff for this file is too large to render.
See raw diff
|
|