<commit_before>import json
import os
import math
import sys

import numpy as np
import cv2

WHITE = (255, 255, 255)
RED = (0, 0, 255)
factor = 1


def gen_labeled_image(description, image, target, debug=None):
    bounds = np.array(description['ImageBB'])

    bounds *= factor

    x0 = bounds[0]
    y0 = bounds[1]
    w = bounds[2] - x0
    h = bounds[3] - y0

    chart = cv2.imread(image, cv2.CV_LOAD_IMAGE_GRAYSCALE)
    # h, w = chart.shape

    print "Image bounds: {} x {}".format(w, h)

    texts = description['ImageText']

    if len(texts) == 0:
        print """No text boxes in chart. Since this could mean that the image
            does not have embedded text, we are ignoring it."""
        return

    label = np.zeros((h, w), np.uint8)

    for text_box in texts:
        tb = np.array(text_box['TextBB'])<commit_msg>Don’t print<commit_after>import json
import math
import sys

import numpy as np
import cv2

WHITE = (255, 255, 255)
RED = (0, 0, 255)
factor = 1


def gen_labeled_image(description, image, target, debug=None):
    bounds = np.array(description['ImageBB'])

    bounds *= factor

    x0 = bounds[0]
    y0 = bounds[1]
    w = bounds[2] - x0
    h = bounds[3] - y0

    chart = cv2.imread(image, cv2.CV_LOAD_IMAGE_GRAYSCALE)
    # h, w = chart.shape

    texts = description['ImageText']

    if len(texts) == 0:
        print """No text boxes in chart. Since this could mean that the image
            does not have embedded text, we are ignoring it."""
        return

    label = np.zeros((h, w), np.uint8)

    for text_box in texts:
        tb = np.array(text_box['TextBB'])
{'fraction_non_alphanumeric': 0.12143742255266418, 'fraction_numerical': 0.03469640644361834, 'mean_word_length': 2.7297921478060045, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6133416', 'n_tokens_mistral': 591, 'n_tokens_neox': 545, 'n_words': 178}