Update app.py
Browse files
app.py
CHANGED
|
@@ -40,6 +40,10 @@ transform = transforms.Compose([
|
|
| 40 |
|
| 41 |
# Predict and save
|
| 42 |
def predict_retinopathy(image):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
| 44 |
img = image.convert("RGB").resize((224, 224))
|
| 45 |
img_tensor = transform(img).unsqueeze(0).to(device)
|
|
|
|
| 40 |
|
| 41 |
# Predict and save
|
| 42 |
def predict_retinopathy(image):
|
| 43 |
+
# Validate image
|
| 44 |
+
if not looks_like_fundus(image):
|
| 45 |
+
return None, "❌ Please upload a valid retinal (fundus) scan."
|
| 46 |
+
|
| 47 |
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
| 48 |
img = image.convert("RGB").resize((224, 224))
|
| 49 |
img_tensor = transform(img).unsqueeze(0).to(device)
|