Spaces:
Build error
Build error
Xiao WANG
commited on
Commit
•
fc9cbd5
1
Parent(s):
6f7a0f1
Deploy model to HF Space
Browse files- .gitattributes +1 -0
- Baroque Architecture.jpg +3 -0
- Gothic Architecture.jpg +3 -0
- Modern Architecture.jpg +3 -0
- app.py +15 -0
- archi_styles_model.pkl +3 -0
.gitattributes
CHANGED
@@ -29,3 +29,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
29 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
30 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
31 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
29 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
30 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
31 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
32 |
+
*.jpg filter=lfs diff=lfs merge=lfs -text
|
Baroque Architecture.jpg
ADDED
Git LFS Details
|
Gothic Architecture.jpg
ADDED
Git LFS Details
|
Modern Architecture.jpg
ADDED
Git LFS Details
|
app.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastai.vision.all import *
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
learn = load_learner('archi_styles_model.pkl')
|
5 |
+
|
6 |
+
styles = ('Baroque Architecture','Gothic Architecture', 'Greek and Roman Classical Architecture', 'Modern Architecture', 'Neoclassical Architecture', 'Neofuturist Architecture', 'Post-Modern Architecture', 'Victorian Architecture')
|
7 |
+
examples = ['Baroque Architecture.jpg', 'Gothic Architecture.jpg', 'Modern Architecture.jpg']
|
8 |
+
|
9 |
+
# Use dict() and zip() to build a dict, not formaliar with data object in python.
|
10 |
+
def image_classifier(img):
|
11 |
+
pred_styles,pred_idx,probs = learn.predict(img)
|
12 |
+
return dict(zip(styles, map(float, probs)))
|
13 |
+
|
14 |
+
demo = gr.Interface(fn=image_classifier, inputs="image", outputs="label", examples = examples)
|
15 |
+
demo.launch()
|
archi_styles_model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8054a45e7972e17cf127c12a4e04a3689ebf8f01349dbb3b4a5c0a2365770b00
|
3 |
+
size 46989487
|