Spaces:
Sleeping
Sleeping
File size: 899 Bytes
9178703 9b31f7b 69f1ee6 9b31f7b b70d34e 9b31f7b 9178703 06ba88e 9178703 f670e89 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
from transformers import pipeline
import gradio as gr
def alz_mri_classification(image):
classifier = pipeline("image-classification", model="dewifaj/alzheimer_mri_classification")
result = classifier(image)
# extract the highest score
prediction = result[0]
score = prediction['score']
label = prediction['label']
return {"score": score, "label": label}
example_image_paths = ["Very_Mild_Demented.png",
"Mild_Demented.png",
"Moderate_Demented.png",
"Non_Demented.png"]
image_input = gr.Image(type="pil", label="Upload Image")
iface = gr.Interface(fn=alz_mri_classification,
inputs=image_input,
outputs="json",
examples=example_image_paths,
title="Alzheimer Recognition from MRI")
iface.launch(share=True)
|