Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -14,12 +14,16 @@ model = AutoModel.from_pretrained('dhhd255/parkinsons_pred0.1')
|
|
14 |
# Move the model to the device
|
15 |
model = model.to(device)
|
16 |
|
17 |
-
|
|
|
18 |
uploaded_file = st.file_uploader("Choose an image...", type=["png", "jpg", "jpeg"])
|
19 |
if uploaded_file is not None:
|
|
|
|
|
20 |
# Load and resize the image
|
21 |
image_size = (224, 224)
|
22 |
new_image = Image.open(uploaded_file).convert('RGB').resize(image_size)
|
|
|
23 |
new_image = np.array(new_image)
|
24 |
new_image = torch.from_numpy(new_image).transpose(0, 2).float().unsqueeze(0)
|
25 |
|
@@ -40,6 +44,6 @@ if uploaded_file is not None:
|
|
40 |
logits = feature_reducer(logits)
|
41 |
predicted_class = torch.argmax(logits, dim=1).item()
|
42 |
if(predicted_class == 0):
|
43 |
-
|
44 |
else:
|
45 |
-
|
|
|
14 |
# Move the model to the device
|
15 |
model = model.to(device)
|
16 |
|
17 |
+
st.title("Parkinson's Disease Prediction")
|
18 |
+
|
19 |
uploaded_file = st.file_uploader("Choose an image...", type=["png", "jpg", "jpeg"])
|
20 |
if uploaded_file is not None:
|
21 |
+
col1, col2 = st.columns(2)
|
22 |
+
|
23 |
# Load and resize the image
|
24 |
image_size = (224, 224)
|
25 |
new_image = Image.open(uploaded_file).convert('RGB').resize(image_size)
|
26 |
+
col1.image(new_image, use_column_width=True)
|
27 |
new_image = np.array(new_image)
|
28 |
new_image = torch.from_numpy(new_image).transpose(0, 2).float().unsqueeze(0)
|
29 |
|
|
|
44 |
logits = feature_reducer(logits)
|
45 |
predicted_class = torch.argmax(logits, dim=1).item()
|
46 |
if(predicted_class == 0):
|
47 |
+
col2.subheader('Predicted class: Parkinson\'s')
|
48 |
else:
|
49 |
+
col2.subheader('Predicted class: Healthy')
|