Mohammed Alakhras commited on
Commit
cb818c2
·
1 Parent(s): 0f8e806

Add application file

Browse files
Files changed (3) hide show
  1. app.ipynb +0 -0
  2. app.py +32 -0
  3. tumorClassifier.pkl +3 -0
app.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
app.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # AUTOGENERATED! DO NOT EDIT! File to edit: app.ipynb.
2
+
3
+ # %% auto 0
4
+ __all__ = ['learn', 'categories', 'image', 'label', 'examples', 'interface', 'classify_image']
5
+
6
+ # %% app.ipynb 1
7
+ from fastai.vision.all import *
8
+ import PIL.Image
9
+ PIL.Image.MAX_IMAGE_PIXELS = None
10
+ from PIL import Image
11
+
12
+ import gradio as gr
13
+
14
+ # %% app.ipynb 2
15
+ learn = load_learner('tumorClassifier.pkl')
16
+
17
+ # %% app.ipynb 3
18
+ categories=('Glioma','Meningioma','Pituitary tumor')
19
+
20
+ def classify_image(img):
21
+ pred,indx,probs=learn.predict(img)
22
+ return dict(zip(categories,map(float,probs)))
23
+
24
+
25
+ # %% app.ipynb 4
26
+ image=gr.inputs.Image(shape=(512,512))
27
+ label=gr.outputs.Label()
28
+ examples=['imagesExample/1.jpeg', 'imagesExample/2.jpg', 'imagesExample/3.png','imagesExample/a.jpg','imagesExample/b.jpg'
29
+ ,'imagesExample/c.jpg','imagesExample/d.jpg','imagesExample/e.jpg','imagesExample/f.jpg']
30
+
31
+ interface=gr.Interface(fn=classify_image, inputs=image ,outputs=label,examples=examples)
32
+ interface.launch(inline=False)
tumorClassifier.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7c19c21766e1c4fd9b8e89cbc0d38ac9e19c3538b2e857120ad8302e96170b17
3
+ size 87534833