Saim8250 commited on
Commit
2d944a2
1 Parent(s): d2d4841

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ learn=load_learner('modelcptn.pkl')
8
+
9
+ categories=('normal','pneumonia','covid19','tuberculosis')
10
+
11
+ def classify_img(img):
12
+ pred,idx,probs=learn.predict(img)
13
+ return dict(zip(categories,map(float,probs)))
14
+
15
+ image =gr.inputs.Image(shape=(192,192))
16
+ label =gr.outputs.Label()
17
+ example=['Normal.jpg','pneumonia.jpg']
18
+ intf=gr.Interface(fn=classify_img,inputs=image,outputs=label,examples=example)
19
+ intf.launch(inline=False)