Spaces:
Sleeping
Sleeping
fix bug with images
Browse files
app.py
CHANGED
|
@@ -19,8 +19,7 @@ from torchvision.transforms.functional import to_pil_image
|
|
| 19 |
from tqdm import tqdm
|
| 20 |
from util import transform
|
| 21 |
|
| 22 |
-
IMAGE_PATH = '
|
| 23 |
-
print(os.listdir(IMAGE_PATH))
|
| 24 |
RANDOM_IMAGES_TO_SHOW = 20
|
| 25 |
IMAGES_PER_ROW = 5
|
| 26 |
|
|
@@ -163,7 +162,9 @@ with gr.Blocks() as demo:
|
|
| 163 |
showed_images = list()
|
| 164 |
loaded_images = load_random_images()
|
| 165 |
amount_rows = max(1, (len(loaded_images) // IMAGES_PER_ROW))
|
| 166 |
-
if len(loaded_images) == 0:
|
|
|
|
|
|
|
| 167 |
for i in range(amount_rows):
|
| 168 |
with gr.Row():
|
| 169 |
for j in range(IMAGES_PER_ROW):
|
|
|
|
| 19 |
from tqdm import tqdm
|
| 20 |
from util import transform
|
| 21 |
|
| 22 |
+
IMAGE_PATH = os.path.join(os.getcwd(), 'src/examples')
|
|
|
|
| 23 |
RANDOM_IMAGES_TO_SHOW = 20
|
| 24 |
IMAGES_PER_ROW = 5
|
| 25 |
|
|
|
|
| 162 |
showed_images = list()
|
| 163 |
loaded_images = load_random_images()
|
| 164 |
amount_rows = max(1, (len(loaded_images) // IMAGES_PER_ROW))
|
| 165 |
+
if len(loaded_images) == 0:
|
| 166 |
+
print(f"Could not find any images in {IMAGE_PATH}")
|
| 167 |
+
amount_rows = 0
|
| 168 |
for i in range(amount_rows):
|
| 169 |
with gr.Row():
|
| 170 |
for j in range(IMAGES_PER_ROW):
|