nishantkdtech commited on
Commit
f39f6a9
·
verified ·
1 Parent(s): 91ad0d4

keepin it a buck

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ __all__ = ['learn', 'classify_image', 'categories', 'image', 'label', 'examples', 'intf']
2
+
3
+ from fastai.vision.all import *
4
+ import gradio as gr
5
+
6
+ learn = load_learner('export.pkl')
7
+
8
+ categories = ('Yes', 'No', 'no')
9
+ def classify_image(img):
10
+ pred, idx, probs = learn.predict(img)
11
+ return dict(zip(categories, map(float, probs)))
12
+
13
+ image=gr.Image(height = 192, width = 192)
14
+ label = gr.Label()
15
+ examples = ['92e4069f-7e8d-43ab-bf44-1a3426c236f8.jpg','34f0c26d-3f52-44f7-bec8-6f17ea662f1b.jpg',
16
+ '1466b365-2800-4558-8d3b-458679828bcc.jpg','2f0f017c-c4dc-452a-b246-d1b57569c36b.jpg',
17
+ 'f7ac1a93-7028-4f94-b84b-363dd978b663.jpg']
18
+ intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
19
+ intf.launch(inline=False)