Saim8250 commited on
Commit
30d350a
·
1 Parent(s): d8e2de0

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
+ from fastai.vision.all import*
3
+ import gradio as gr
4
+
5
+ def is_cat(x):returnx[0].isupper()
6
+
7
+
8
+ learn=load_learner('HAMM(1).pkl')
9
+
10
+ categories=learn.dls.vocab
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=['Acne.jpg','Eczema.jpg']
19
+ intf=gr.Interface(fn=classify_img,inputs=image,outputs=label,examples=example)
20
+ intf.launch(inline=False,share=False)