Saim8250 commited on
Commit
257266d
·
1 Parent(s): 983f205

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ !import fastai
2
+ import fastai
3
+ from fastai.vision.all import*
4
+ import gradio as gr
5
+
6
+ def is_cat(x):returnx[0].isupper()
7
+
8
+ learn=load_learner('my_export_HAM10000.pkl')
9
+
10
+ categories=('akiec','bcc','bkl','df','mel','nv','vasc')
11
+
12
+ def classify_img(img):
13
+ pred,idx,probs=learn.predict(img)
14
+ return dict(zip(categories,map(float,probs)))
15
+
16
+ image =gr.inputs.Image(shape=(192,192))
17
+ label =gr.outputs.Label()
18
+ example=['mel.jpg','akiec.jpg','vasc.jpg']
19
+ intf=gr.Interface(fn=classify_img,inputs=image,outputs=label,examples=example)
20
+ intf.launch(inline=False)