<commit_before>import uuid

from flask import Flask
from flask import (
    request,
    make_response,
    render_template,
    jsonify,
)

app = Flask(__name__)

counts = {}


@app.route('/')
def index():
    user_id = request.cookies.get('uuid')

    response = make_response(render_template(
        'top.html',
        my_count=counts.get(user_id, 0),
        all_count=sum(counts.values()),
    ))

    if not user_id:
        uuid_str = str(uuid.uuid4())
        response.set_cookie('uuid', uuid_str)
        counts[uuid_str] = 0

    return response


@app.route('/api/client', methods=['POST'])
def push_from_client():
    print(counts)
    user_id = request.cookies.get('uuid')
    if not user_id:
        return jsonify(message='uuid not set'), 404

    counts[user_id] = int(request.form['count'])
    return jsonify(yours=counts[user_id], all=sum(counts.values()))


if __name__ == '__main__':
    app.run(debug=True, host='0.0.0.0')<commit_msg>デバッグコード抜き忘れ<commit_after>import uuid

from flask import Flask
from flask import (
    request,
    make_response,
    render_template,
    jsonify,
)

app = Flask(__name__)

counts = {}


@app.route('/')
def index():
    user_id = request.cookies.get('uuid')

    response = make_response(render_template(
        'top.html',
        my_count=counts.get(user_id, 0),
        all_count=sum(counts.values()),
    ))

    if not user_id:
        uuid_str = str(uuid.uuid4())
        response.set_cookie('uuid', uuid_str)
        counts[uuid_str] = 0

    return response


@app.route('/api/client', methods=['POST'])
def push_from_client():
    user_id = request.cookies.get('uuid')
    if not user_id:
        return jsonify(message='uuid not set'), 404

    counts[user_id] = int(request.form['count'])
    return jsonify(yours=counts[user_id], all=sum(counts.values()))


if __name__ == '__main__':
    app.run(debug=True, host='0.0.0.0')
{'fraction_non_alphanumeric': 0.14767932489451477, 'fraction_numerical': 0.010548523206751054, 'mean_word_length': 3.2725225225225225, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '3455010', 'n_tokens_mistral': 692, 'n_tokens_neox': 670, 'n_words': 124}