mxbi / arckit

Tools for working with the Abstraction & Reasoning Corpus
Apache License 2.0
126 stars 17 forks source link

Feature: Added print_grid function, print grid to terminal #2

Open Rafaelblsilva opened 10 months ago

Rafaelblsilva commented 10 months ago

@mxbi Thanks for the awesome project!

I Haphazardly added a function to print the grid to the terminal. It is based on the rich library.

Example:


import arckit
import arckit.vis as vis
train_set, eval_set = arckit.load_data() # Load ARC1 train/eval

task = train_set[0]

for ex in task.train:
    print("Input: ")
    grid = vis.draw_grid(ex[0])
    vis.print_grid(grid)
    print('Output: ')
    grid = vis.draw_grid(ex[1])
    vis.print_grid(grid)
    print()

Should print to the terminal:

image

mxbi commented 10 months ago

Awesome! I really like the printing style.

I'm wondering whether we can extend this to take in numpy arrays (the standard grid format for Task) rather than essentially inverting the draw_grid call, which might have some weird behaviour if called on the result of draw_task, for example.