Addai commited on
Commit
9d0719f
·
1 Parent(s): 3f880ca

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from fastai.vision.all import *
3
+ import skimage
4
+
5
+ learn = load_learner('export.pkl')
6
+
7
+ labels = learn.dls.vocab
8
+ def predict(img):
9
+ img = PILImage.create(img)
10
+ pred,pred_idx,probs = learn.predict(img)
11
+ prediction = str(pred)
12
+
13
+ return prediction
14
+
15
+
16
+ title = "Lung cancer detection with Deep Transfer Learning(ResNet18)"
17
+ description = "<p style='text-align: center'><b>As a radiologist or oncologist, it is crucial to know what is wrong with a lung CT image.<b><br><b>Upload the breast X-ray image to know what is wrong with a patients breast with or without inplant<b><p>"
18
+ article="<p style='text-align: center'>Web app is built and managed by Mr.<b></p>"
19
+ examples = ['img1.jpeg', 'img2.jpeg']
20
+ enable_queue=True
21
+ #interpretation='default'
22
+
23
+ gr.Interface(fn=predict,inputs=gr.inputs.Image(shape=(512, 512)),outputs=gr.outputs.Label(num_top_classes=3),title=title,description=description,article=article,examples=examples,enable_queue=enable_queue).launch()