Spaces:
Sleeping
Sleeping
File size: 953 Bytes
788c023 424ed9f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# AUTOGENERATED! DO NOT EDIT! File to edit: ../colo_app.ipynb.
# %% auto 0
__all__ = ['learn', 'image', 'label', 'examples', 'intf', 'classify_img']
# %% ../colo_app.ipynb 1
from fastai.vision.all import *
import gradio as gr
# %% ../colo_app.ipynb 4
learn = load_learner('export.pkl')
# %% ../colo_app.ipynb 7
def classify_img(img):
pred, cl, probs = learn.predict(img)
prob0 = float(probs[0])
prob1 = float(probs[1])
d = {
"This is a colonoscopy photo --- probability:":prob0,
"This is not a colonoscopy photo --- probability:":prob1
}
return d
# %% ../colo_app.ipynb 9
image = gr.inputs.Image(shape=(192,192))
label = gr.outputs.Label()
examples = ['colonoscopy.jpg','colonoscopy2.jpg','colonoscopy3.jpg','colonoscopy4.jpg', 'white_square.jpg','dog.jpeg','pinkroundball.jpeg','earthworm.jpg']
intf=gr.Interface(fn=classify_img, inputs=image, outputs=label, examples=examples)
intf.launch(inline=False)
|