<commit_before>from flask import Flask, url_for, render_template
app = Flask(__name__)


@app.route("/")
def index():
    return render_template("index.html")

if __name__ == "__main__":
    app.debug = True
    app.run()<commit_msg>processing for punchable faces<commit_after>from flask import Flask, url_for, render_template, request
import base64
import cv2

app = Flask(__name__)
punch_cascade = cv2.CascadeClassifier("static/punchable_classifier.xml")


@app.route("/")
def index():
    return render_template("index.html")

@app.route("/punch", methods=["POST"])
def punch():
    if request.method == "POST":
        img_64 = request.args["image"]
        image_raw = base64.b64decode(img_64)
        image = cv2.imread(image_raw)
        gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
        faces = face_cascade.detectMultiScale(
                gray,
                scaleFactor=1.6,
                minNeighbors=5,
                minSize=(30, 30),
        )
        for x, y, w, h in faces:
            cv2.rectangle(image, (x, y), (x+w, y+h), (255, 0, 255), 2)
        if len(faces) == 0:
            return False
        else:
            return True


if __name__ == "__main__":
    app.debug = True
    app.run()
{'fraction_non_alphanumeric': 0.13110749185667753, 'fraction_numerical': 0.02687296416938111, 'mean_word_length': 2.5935672514619883, 'pattern_counts': {'":': 3, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 1}, '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': '3757881', 'n_tokens_mistral': 431, 'n_tokens_neox': 406, 'n_words': 94}