Skip to content

Instantly share code, notes, and snippets.

@tezansahu
Last active February 12, 2022 14:25
Show Gist options
  • Save tezansahu/61950a3ffb0664d8904f5eb4bcb950bb to your computer and use it in GitHub Desktop.
Save tezansahu/61950a3ffb0664d8904f5eb4bcb950bb to your computer and use it in GitHub Desktop.
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