Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# AUTOGENERATED! DO NOT EDIT! File to edit: . (unless otherwise specified).
|
2 |
+
|
3 |
+
__all__ = ['learn', 'classify_image', 'categories', 'image', 'label', 'examples', 'intf']
|
4 |
+
|
5 |
+
# Cell
|
6 |
+
from fastai.vision.all import *
|
7 |
+
import gradio as gr
|
8 |
+
|
9 |
+
|
10 |
+
# Cell
|
11 |
+
learn=load_learner("metamodel.pkl")
|
12 |
+
|
13 |
+
# Cell
|
14 |
+
categories = ("Foundation Pouring","Frame Installation","Land Excavation")
|
15 |
+
|
16 |
+
def classify_image(img):
|
17 |
+
pred, idx, probs = learn.predict(img)
|
18 |
+
return dict(zip(categories, map(float, probs)))
|
19 |
+
|
20 |
+
# Cell
|
21 |
+
image = gr.Inputs.Image(shape=(512,512))
|
22 |
+
label = gr.Outputs.Label()
|
23 |
+
examples = ['FoundationPouring00.PNG','FrameInstallation00.PNG','LandExcavation00.PNG']
|
24 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
25 |
+
intf.launch(inline=False)
|