|
|
|
|
|
"""App.ipynb |
|
|
|
|
|
Automatically generated by Colab. |
|
|
|
|
|
Original file is located at |
|
|
https://colab.research.google.com/drive/1sSLrAgb1d83QPcQ4_UtxD86m0pS4i7s6 |
|
|
""" |
|
|
|
|
|
|
|
|
from fastai.vision.all import * |
|
|
import gradio as gr |
|
|
|
|
|
|
|
|
learn=load_learner('fracturedmodel.pkl') |
|
|
|
|
|
|
|
|
categories=("This is a fractured bone.", "Bone does not appear to be fractured.") |
|
|
def classify_image(img): |
|
|
pred,idx,probs=learn.predict(img) |
|
|
return dict(zip(categories, map(float, probs))) |
|
|
|
|
|
|
|
|
with gr.Blocks(theme='Nymbo/Alyx_Theme') as demo: |
|
|
gr.Markdown( """ |
|
|
# Radiology Report |
|
|
Upload your xray to create a radiology report. |
|
|
""") |
|
|
image = gr.Image(type="pil",label="Upload your x-ray") |
|
|
classify_btn = gr.Button("Create Report") |
|
|
label = gr.Label(label="Radiology Report") |
|
|
examples = gr.Examples(['arm.png', 'hand.png', 'broken1.jpg','nbroken1.jpg'], image) |
|
|
classify_btn.click(fn=classify_image, inputs=image, outputs=label) |
|
|
|
|
|
|
|
|
|
|
|
demo.launch(inline=False) |