shuffle images
Browse files
app.py
CHANGED
@@ -6,7 +6,6 @@ import gradio as gr
|
|
6 |
import numpy as np
|
7 |
from PIL import Image
|
8 |
import random
|
9 |
-
import time
|
10 |
from db import compute_elo_scores, get_all_votes
|
11 |
|
12 |
# Configure logging
|
@@ -53,10 +52,9 @@ def update_rankings_table():
|
|
53 |
def select_new_image():
|
54 |
"""Select a new image and its segmented versions."""
|
55 |
image_paths = load_images_from_directory("data/web-original-images")
|
|
|
56 |
last_image_path = None
|
57 |
max_attempts = 10
|
58 |
-
|
59 |
-
random.seed(time.time())
|
60 |
|
61 |
for _ in range(max_attempts):
|
62 |
available_images = [path for path in image_paths if path != last_image_path]
|
|
|
6 |
import numpy as np
|
7 |
from PIL import Image
|
8 |
import random
|
|
|
9 |
from db import compute_elo_scores, get_all_votes
|
10 |
|
11 |
# Configure logging
|
|
|
52 |
def select_new_image():
|
53 |
"""Select a new image and its segmented versions."""
|
54 |
image_paths = load_images_from_directory("data/web-original-images")
|
55 |
+
random.shuffle(image_paths) # Shuffle images to ensure randomness on reload
|
56 |
last_image_path = None
|
57 |
max_attempts = 10
|
|
|
|
|
58 |
|
59 |
for _ in range(max_attempts):
|
60 |
available_images = [path for path in image_paths if path != last_image_path]
|