<commit_before>import os
import base64

html = "<html><head></head><body>"

with open('filelist.txt') as fp:
  for fn in fp:
    with open(fn, "rb") as image_file:
      im_type = os.path.splitext(os.path.basename(fn))[-1][1:]
      html += '<p><img src="data:image/{};base64,{}" /></p>'.format(im_type, base64.b64encode(image_file.read()))

html += "</body>"<commit_msg>Bugfix: Fixed encoding issue with py3<commit_after>import os
import base64

html = "<html><head></head><body>"

with open('filelist.txt') as fp:
  for fn in (ffn.strip() for ffn in fp):
    with open(fn, "rb") as image_file:
      im_type = os.path.splitext(os.path.basename(fn))[-1][1:]
      html += '<p align="center"><img src="data:image/{};base64,{}" /></p>'.format(
        im_type, base64.b64encode(image_file.read()).decode('ascii'))

html += "</body>"
{'fraction_non_alphanumeric': 0.21660649819494585, 'fraction_numerical': 0.02527075812274368, 'mean_word_length': 4.402597402597403, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5870637', 'n_tokens_mistral': 323, 'n_tokens_neox': 305, 'n_words': 66}