From: Francois Fleuret Date: Fri, 15 Jul 2022 15:52:40 +0000 (+0200) Subject: Update. X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=dbbed675efe5ae5e7859106519de8a69947f0766;p=mygpt.git Update. --- diff --git a/picoclvr.py b/picoclvr.py index 6dd8114..26f53ab 100755 --- a/picoclvr.py +++ b/picoclvr.py @@ -90,6 +90,8 @@ def all_properties(height, width, nb_squares, square_i, square_j, square_c): return s +###################################################################### + def generate(nb, height = 6, width = 8, max_nb_squares = 5, max_nb_statements = 10, many_colors = False): @@ -152,13 +154,12 @@ def descr2img(descr, height = 6, width = 8): if __name__ == '__main__': descr = generate(nb = 5) - for d in descr: - print(d) - print() - img = descr2img(descr) - print(img.size()) + with open('picoclvr_example.txt', 'w') as f: + for d in descr: + f.write(f'{d}\n\n') + img = descr2img(descr) torchvision.utils.save_image(img / 255., 'picoclvr_example.png', nrow = 16, pad_value = 0.8)