Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -87,6 +87,23 @@ def segment_image(pil_img):
|
|
| 87 |
2,
|
| 88 |
)
|
| 89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
return image_np # RGB numpy array works with gr.Image
|
| 91 |
|
| 92 |
with gr.Blocks() as demo:
|
|
|
|
| 87 |
2,
|
| 88 |
)
|
| 89 |
|
| 90 |
+
def get_sample_images():
|
| 91 |
+
"""
|
| 92 |
+
Get list of sample images from Eye_Dataset folder.
|
| 93 |
+
Returns a list of image file paths.
|
| 94 |
+
"""
|
| 95 |
+
dataset_dir = "Eye_Dataset"
|
| 96 |
+
if not os.path.exists(dataset_dir):
|
| 97 |
+
return []
|
| 98 |
+
|
| 99 |
+
sample_images = []
|
| 100 |
+
for filename in os.listdir(dataset_dir):
|
| 101 |
+
if filename.lower().endswith(('.png', '.jpg', '.jpeg')):
|
| 102 |
+
filepath = os.path.join(dataset_dir, filename)
|
| 103 |
+
sample_images.append(filepath)
|
| 104 |
+
|
| 105 |
+
return sample_images[:10] # Return max 10 sample images
|
| 106 |
+
|
| 107 |
return image_np # RGB numpy array works with gr.Image
|
| 108 |
|
| 109 |
with gr.Blocks() as demo:
|