Update app.py
Browse files
app.py
CHANGED
|
@@ -3,6 +3,7 @@ Eye Screen backend — deploy on Hugging Face Spaces (Gradio SDK).
|
|
| 3 |
Pipeline: image quality gate -> pretrained DR classifier -> Grad-CAM -> calibrated confidence.
|
| 4 |
This is the "real model" half of the app. Google AI Studio frontend calls this via its API.
|
| 5 |
"""
|
|
|
|
| 6 |
import spaces
|
| 7 |
import cv2
|
| 8 |
import numpy as np
|
|
@@ -59,6 +60,7 @@ def preprocess(img_pil):
|
|
| 59 |
return tensor, arr
|
| 60 |
|
| 61 |
|
|
|
|
| 62 |
def predict(image):
|
| 63 |
if image is None:
|
| 64 |
return "No image uploaded", "", None, {}
|
|
@@ -106,3 +108,4 @@ demo = gr.Interface(
|
|
| 106 |
|
| 107 |
if __name__ == "__main__":
|
| 108 |
demo.launch()
|
|
|
|
|
|
| 3 |
Pipeline: image quality gate -> pretrained DR classifier -> Grad-CAM -> calibrated confidence.
|
| 4 |
This is the "real model" half of the app. Google AI Studio frontend calls this via its API.
|
| 5 |
"""
|
| 6 |
+
|
| 7 |
import spaces
|
| 8 |
import cv2
|
| 9 |
import numpy as np
|
|
|
|
| 60 |
return tensor, arr
|
| 61 |
|
| 62 |
|
| 63 |
+
@spaces.GPU(duration=30)
|
| 64 |
def predict(image):
|
| 65 |
if image is None:
|
| 66 |
return "No image uploaded", "", None, {}
|
|
|
|
| 108 |
|
| 109 |
if __name__ == "__main__":
|
| 110 |
demo.launch()
|
| 111 |
+
|