File size: 428 Bytes
f4da933
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import numpy as np
import os
from typing import Tuple


SAMPLE_IMAGE_S3_PATH = os.getenv("SAMPLE_IMAGE_S3_PATH", ".")


def get_random_sample_image() -> Tuple[str, str]:
    rnd_img_sub_path: str = np.random.choice(
        np.loadtxt("sample_list.txt", dtype=object)
    )
    rnd_img = os.path.join(SAMPLE_IMAGE_S3_PATH, rnd_img_sub_path)
    label = rnd_img.split("/")[-2].replace("_", " ").title()
    return rnd_img, label