bilalUWE commited on
Commit
0928b0f
1 Parent(s): 6401a96

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -0
app.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
7
+ from fastai.vision.all import *
8
+ import gradio as gr
9
+
10
+
11
+ # Cell
12
+ learn=load_learner("metamodel.pkl")
13
+
14
+ # Cell
15
+ categories = ("Foundation Pouring","Frame Installation","Land Excavation")
16
+
17
+ def classify_image(img):
18
+ pred,idx,probs = learn.predict(img)
19
+ return dict(zip(categories, map(float,probs)))
20
+
21
+ # Cell
22
+ image = gr.inputs.Image(shape=(512, 512))
23
+ label = gr.outputs.Label()
24
+ examples = ["FoundationPouring00.PNG","FrameInstallation00.PNG","LandExcavation00.PNG"]
25
+
26
+ intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
27
+ intf.launch()