Last active
February 12, 2022 14:25
-
-
Save tezansahu/61950a3ffb0664d8904f5eb4bcb950bb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from IPython.display import display | |
def showExample(train=True, id=None): | |
if train: | |
data = dataset["train"] | |
else: | |
data = dataset["test"] | |
if id == None: | |
id = np.random.randint(len(data)) | |
image = Image.open(os.path.join("..", "dataset", "images", data[id]["image_id"] + ".png")) | |
display(image) | |
print("Question:\t", data[id]["question"]) | |
print("Answer:\t\t", data[id]["answer"], "(Label: {0})".format(data[id]["label"])) | |
showExample() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment