<commit_before>from flask import Flask

app = Flask(__name__)


@app.route("/")
def hello():
    return "Hello World!"


if __name__ == "__main__":
    app.run()<commit_msg>gen qrcode api<commit_after>import qrcode
from StringIO import StringIO
from flask import Flask, send_file, request

app = Flask(__name__)


@app.route("/")
def hello():
    return "Hello World!"


@app.route('/v1/qrcode', methods=['POST'])
def v1_qrcode():
    box_size = request.args.get('box_size', 10)
    border = request.args.get('border', 4)

    qr = qrcode.QRCode(
        version=1,
        error_correction=qrcode.constants.ERROR_CORRECT_L,
        box_size=box_size,
        border=border,
    )
    qr.add_data(request.data)
    qr.make(fit=True)

    img = qr.make_image()
    return _serve_pil_image(img)


def _serve_pil_image(pil_img):
    img_io = StringIO()
    pil_img.save(img_io, 'PNG')
    img_io.seek(0)
    return send_file(img_io, mimetype='image/jpeg')


if __name__ == "__main__":
    app.run(debug=True)
{'fraction_non_alphanumeric': 0.13930348258706468, 'fraction_numerical': 0.006965174129353234, 'mean_word_length': 3.614678899082569, 'pattern_counts': {'":': 2, '<': 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': '5782158', 'n_tokens_mistral': 396, 'n_tokens_neox': 374, 'n_words': 73}