Spaces:
Sleeping
Sleeping
Commit
•
316ef41
1
Parent(s):
2af2d78
Add model and app files.
Browse files- .gitattributes +1 -0
- app.py +30 -0
- house_model.pkl +3 -0
- modern_house.jpg +0 -0
- ranch_house.jpg +3 -0
- requirements.txt +2 -0
- victorian_house.jpg +0 -0
.gitattributes
CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
ranch_house.jpg filter=lfs diff=lfs merge=lfs -text
|
app.py
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
+
import skimage
|
4 |
+
|
5 |
+
learn = load_learner("export.pkl")
|
6 |
+
|
7 |
+
labels = learn.dls.vocab
|
8 |
+
|
9 |
+
|
10 |
+
def predict(img):
|
11 |
+
img = PILImage.create(img)
|
12 |
+
pred, pred_idx, probs = learn.predict(img)
|
13 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
14 |
+
|
15 |
+
|
16 |
+
title = "House Style Classifier"
|
17 |
+
description = (
|
18 |
+
"Classifier that will classify a style of house into modern, ranch or victorian."
|
19 |
+
)
|
20 |
+
examples = ["modern_house.jpg", "ranch_house.jpg", "victorian_house.jpg"]
|
21 |
+
interpretation = "default"
|
22 |
+
gr.Interface(
|
23 |
+
fn=predict,
|
24 |
+
inputs=gr.inputs.Image(shape=(512, 512)),
|
25 |
+
outputs=gr.outputs.Label(num_top_classes=3),
|
26 |
+
title=title,
|
27 |
+
description=description,
|
28 |
+
examples=examples,
|
29 |
+
interpretation=interpretation,
|
30 |
+
).launch(share=True)
|
house_model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:12edf9dc0b7e1f128b1ab45f8438ddeee791edc90362d95fdd63c2946984a9f1
|
3 |
+
size 46957103
|
modern_house.jpg
ADDED
![]() |
ranch_house.jpg
ADDED
![]() |
Git LFS Details
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
fastai
|
2 |
+
scikit-image
|
victorian_house.jpg
ADDED
![]() |