<commit_before><html>
  <head>
    <title>JPEG Artifact Generator</title>
    <style>
div { border: 1px solid black; margin: 1px; display: inline-block;}
    </style>
  </head>
  <body>
    <h1>JPEG Artifact Generator</h1>
    <input type="file" id="uploadimage" /><!-- or
    <button onClick="openURL()">Use URL:</button> <input id="lurl" type="text" /> --> <br/>
    <button onClick="doIt()">Create JPEG Artifacts</button>
    Base JPEG compression: <input id="factor" type="range" min="0" max=".5" step=".01" value=".2" onchange="document.getElementById('fval').innerHTML=this.value" /><label id="fval">.2</label>
    <br/><br/>
    <div>Input:<br/><img id="in" /></div>
    <div>Output:<br/><img id="out" /></div>
    <script>

var cvs = document.createElement('canvas');
var ctx = cvs.getContext('2d');

function openFile(ev) {
    var img = document.getElementById('out');
    var oimg = document.getElementById('in');
    var f = document.getElementById("uploadimage").files[0];
    var url = window.URL || window.webkitURL;
    var src = url.createObjectURL(f);

    img.src = src;
    oimg.src = src;
    img.onload = function() {
        cvs.height = img.height;
        cvs.width = img.width;
        ctx.drawImage(img, 0, 0);
        url.revokeObjectURL(src);
    }
}

function openURL() {
    var img = document.getElementById('out');
    var oimg = document.getElementById('in');
    var src = document.getElementById('lurl').value;

    img.src = src;
    oimg.src = src;
    img.onload = function() {
        cvs.height = img.height;
        cvs.width = img.width;
        ctx.drawImage(img, 0, 0);
    }
}

function doIt() {
    var img = document.getElementById('out');
    var factor = document.getElementById('factor').value * 1.0;

    img.src = cvs.toDataURL("image/jpeg",factor + Math.random()*0.1);
    ctx.drawImage(img,0,0);
}

document.getElementById("uploadimage").addEventListener("change", openFile, false);


    </script><commit_msg>Reset<commit_after><html>
  <head>
    <title>JPEG Artifact Generator</title>
    <style>
div { border: 1px solid black; margin: 1px; display: inline-block;}
    </style>
  </head>
  <body>
    <h1>JPEG Artifact Generator</h1>
    <input type="file" id="uploadimage" /><!-- or
    <button onClick="openURL()">Use URL:</button> <input id="lurl" type="text" /> --> <br/>
    <button onClick="doIt()">Create JPEG Artifacts</button>
    Base JPEG compression: <input id="factor" type="range" min="0" max=".5" step=".01" value=".2" onchange="document.getElementById('fval').innerHTML=this.value" /><label id="fval">.2</label>
    <button onClick="reset()">Reset</button>
    <br/><br/>
    <div>Input:<br/><img id="in" /></div>
    <div>Output:<br/><img id="out" /></div>
    <script>

var cvs = document.createElement('canvas');
var ctx = cvs.getContext('2d');

function reset() {
    var img = document.getElementById('out');
    var oimg = document.getElementById('in');

    img.src = oimg.src;
    ctx.drawImage(oimg, 0, 0);
}

function openFile(evnt) {
    var img = document.getElementById('out');
    var oimg = document.getElementById('in');
    var f = document.getElementById("uploadimage").files[0];
    var url = window.URL || window.webkitURL;
    var src = url.createObjectURL(f);

    img.src = src;
    oimg.src = src;
    img.onload = function() {
        cvs.height = img.height;
        cvs.width = img.width;
        ctx.drawImage(img, 0, 0);
    }
}

function openURL() {
    var img = document.getElementById('out');
    var oimg = document.getElementById('in');
    var src = document.getElementById('lurl').value;

    img.src = src;
    oimg.src = src;
    img.onload = function() {
        cvs.height = img.height;
        cvs.width = img.width;
        ctx.drawImage(img, 0, 0);
    }
}

function doIt() {
    var img = document.getElementById('out');
    var factor = document.getElementById('factor').value * 1.0;

    img.src = cvs.toDataURL("image/jpeg",factor + Math.random()*0.1);
    ctx.drawImage(img,0,0);
}

document.getElementById("uploadimage").addEventListener("change", openFile, false);


    </script>
{'fraction_non_alphanumeric': 0.184652862362972, 'fraction_numerical': 0.01120584652862363, 'mean_word_length': 3.344973544973545, 'pattern_counts': {'":': 0, '<': 71, '<?xml version=': 0, '>': 71, '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': '2829506', 'n_tokens_mistral': 1410, 'n_tokens_neox': 1359, 'n_words': 285}