Upload 5 files
Browse files- App.py +19 -0
- Requirements.txt +1 -0
- benign.jpg +0 -0
- export.pkl +3 -0
- malignant.jpg +0 -0
App.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastai.vision.all import *
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
learn = load_learner("export.pkl")
|
| 5 |
+
|
| 6 |
+
categories = ("Benign", "Malignant")
|
| 7 |
+
|
| 8 |
+
def classify_image(img):
|
| 9 |
+
pred,idx,probs = learn.predict(img)
|
| 10 |
+
return dict(zip(categories, map(float,probs)))
|
| 11 |
+
|
| 12 |
+
image = gr.Image()
|
| 13 |
+
label = gr.Label()
|
| 14 |
+
examples = ['benign.jpg','malignant.jpg']
|
| 15 |
+
title = 'Skin Cancer Predictor'
|
| 16 |
+
description = 'This app predicts skin cancer. For reference only.'
|
| 17 |
+
|
| 18 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples, title=title, description=description)
|
| 19 |
+
intf.launch(inline=False)
|
Requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
fastai
|
benign.jpg
ADDED
|
export.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e782ff6d39d23f8636a030ac3f916296a29e3b2057b562cfe60090c1542365be
|
| 3 |
+
size 47107006
|
malignant.jpg
ADDED
|