dewifaj's picture
Update app.py
9178703 verified
raw
history blame
809 Bytes
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 = ["example_image1.jpg", "example_image2.jpg", "example_image3.jpg", "example_image4.jpg"]
image_input = gr.Image(type="pil", label="Upload Image")
iface = gr.Interface(fn=alz_mri_classification,
inputs=image_input,
outputs="json",
example = example_image_paths,
title="Alzheimer Recognition from MRI")
iface.launch()