Spaces:
Sleeping
Sleeping
intial pkl etc
Browse files- app.py +17 -4
- architecture_model.pkl +3 -0
- georgian_terrace.jpg +0 -0
- tudor_cottage.jpg +0 -0
app.py
CHANGED
@@ -1,7 +1,20 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
def greet(name):
|
4 |
-
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastai.vision.all import *
|
2 |
import gradio as gr
|
3 |
|
|
|
|
|
4 |
|
5 |
+
def classify(the_image):
|
6 |
+
prediction, index, probs = learn.predict(the_image)
|
7 |
+
probs_floats = map(float, probs)
|
8 |
+
cat_probs = zip(categories, probs_floats)
|
9 |
+
return dict(cat_probs)
|
10 |
+
|
11 |
+
|
12 |
+
learn = load_learner('architecture_model.pkl')
|
13 |
+
categories = learn.dls.vocab
|
14 |
+
|
15 |
+
image = gr.inputs.Image(shape=(192, 192))
|
16 |
+
label = gr.outputs.Label()
|
17 |
+
examples = ['tudor_cottage.jpg', 'geogian_terrace.jpg']
|
18 |
+
|
19 |
+
intf = gr.Interface(fn=classify, inputs=image, outputs=label, examples=examples, title="Architecture Classifier")
|
20 |
+
intf.launch(inline=False)
|
architecture_model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6ab888cab02c70b1c40a8e8fb6ee4571bc1e371d0d0a790e133a390d2dce5031
|
3 |
+
size 46967105
|
georgian_terrace.jpg
ADDED
![]() |
tudor_cottage.jpg
ADDED
![]() |