Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
def alz_mri_classification(image):
|
3 |
+
classifier = pipeline("image-classification", model="dewifaj/alzheimer_mri_classification")
|
4 |
+
result = classifier(image)
|
5 |
+
# extract the highest score
|
6 |
+
prediction = result[0]
|
7 |
+
score = prediction['score']
|
8 |
+
label = prediction['label']
|
9 |
+
return {"score": score, "label": label}
|
10 |
+
|
11 |
+
image_input = gr.Image(type="pil", label="Upload Image")
|
12 |
+
iface = gr.Interface(fn=alz_mri_classification, inputs=image_input, outputs="json", title="Alzheimer Recognition from MRI")
|
13 |
+
iface.launch()
|