Update app.py
Browse files
app.py
CHANGED
@@ -41,6 +41,18 @@ def image_classifier(image):
|
|
41 |
image = Image.fromarray(image)
|
42 |
image = data_transform(image)
|
43 |
image = image.unsqueeze(0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
# Load and preprocess the image
|
46 |
img_path = '/content/test_image_healthy.png'
|
|
|
41 |
image = Image.fromarray(image)
|
42 |
image = data_transform(image)
|
43 |
image = image.unsqueeze(0)
|
44 |
+
|
45 |
+
# Use your custom model for inference
|
46 |
+
with torch.no_grad():
|
47 |
+
outputs = model(image)
|
48 |
+
_, predicted = torch.max(outputs.data, 1)
|
49 |
+
|
50 |
+
# Map the index to a class label
|
51 |
+
labels = ['Healthy', 'Parkinson']
|
52 |
+
predicted_label = labels[predicted.item()]
|
53 |
+
|
54 |
+
# Return the result
|
55 |
+
return outputs[0].numpy(), predicted_label
|
56 |
|
57 |
# Load and preprocess the image
|
58 |
img_path = '/content/test_image_healthy.png'
|