Beispiel #1
0
def index(request):
    title = u"图片识别"
    category_id = request.GET.get("category_id")

    random_count = 50
    if category_id:
        category_id = int(category_id)
        category = Category.objects.get(id=category_id)
        captchas = Captcha.objects.filter(label_count__lt=3, category=category_id)[:random_count]
        labeled_captcha_count = Captcha.objects.filter(label_count__gt=2, category=category_id).count()
        captcha_count = Captcha.objects.filter(category=category_id).all().count()
    else:
        captchas = Captcha.objects.filter(label_count__lt=3)[:random_count]
        labeled_captcha_count = Captcha.objects.filter(label_count__gt=2).count()
        captcha_count = Captcha.objects.all().count()
        category = None

    if len(captchas) > 1:
        random_index = random.randint(0, len(captchas))
        captcha = captchas[random_index]
    elif len(captchas) == 1:
        captcha = captchas[0]
    else:
        captcha = None

    categories = Category.objects.all()

    return render_template("captcha/index.html",
                           request=request,
                           labeled_captcha_count=labeled_captcha_count,
                           catpcha_count=captcha_count,
                           title=title,
                           captcha=captcha,
                           categories=categories,
                           category=category)
Beispiel #2
0
def labeled(request, page=1):
    qs = Captcha.objects.filter(label_count__gt=2)
    pager = do_paginator(qs, page, 20)
    prefix = reverse("captcha.views.labeled")

    return render_template("captcha/labeled.html",
                           request=request,
                           pager=pager,
                           prefix=prefix)
Beispiel #3
0
def index(request):
    title = u"图片识别"
    category_id = request.GET.get("category_id")

    random_count = 50
    if category_id:
        category_id = int(category_id)
        category = Category.objects.get(id=category_id)
        captchas = Captcha.objects.filter(label_count__lt=3,
                                          category=category_id)[:random_count]
        labeled_captcha_count = Captcha.objects.filter(
            label_count__gt=2, category=category_id).count()
        captcha_count = Captcha.objects.filter(
            category=category_id).all().count()
    else:
        captchas = Captcha.objects.filter(label_count__lt=3)[:random_count]
        labeled_captcha_count = Captcha.objects.filter(
            label_count__gt=2).count()
        captcha_count = Captcha.objects.all().count()
        category = None

    if len(captchas) > 1:
        random_index = random.randint(0, len(captchas))
        captcha = captchas[random_index]
    elif len(captchas) == 1:
        captcha = captchas[0]
    else:
        captcha = None

    categories = Category.objects.all()

    return render_template("captcha/index.html",
                           request=request,
                           labeled_captcha_count=labeled_captcha_count,
                           catpcha_count=captcha_count,
                           title=title,
                           captcha=captcha,
                           categories=categories,
                           category=category)
Beispiel #4
0
def page_404(request):
    return render_template("404.html", request=request)
Beispiel #5
0
def clawer_setting(request):
    return render_template("clawer/setting.html", request=request)
Beispiel #6
0
def clawer_generate_log(request):
    return render_template("clawer/generate_log.html", request=request)
Beispiel #7
0
def clawer_analysis_log(request):
    return render_template("clawer/analysis_log.html", request=request)
Beispiel #8
0
def clawer_download_log(request):
    return render_template("clawer/download_log.html", request=request)
Beispiel #9
0
def day(request):
    return render_template("clawer/monitor/day.html", request=request)
Beispiel #10
0
def clawer(request):
    return render_template("clawer/index.html", request=request)
Beispiel #11
0
def index(request):
    return render_template("clawer/logger/index.html", request=request)
Beispiel #12
0
def get_all(request):
    return render_template('enterprise/get_all.html', request=request, Province=Province)
Beispiel #13
0
def realtime_dashboard(request):
    return render_template("clawer/monitor/realtime_dashboard.html",
                           request=request)
Beispiel #14
0
def page_500(request):
    return render_template("500.html", request=request)
Beispiel #15
0
def clawer_all(request):
    return render_template("clawer/all.html", request=request)
Beispiel #16
0
def index(request):
    return render_template("index.html", request=request)
Beispiel #17
0
def clawer_task(request):
    return render_template("clawer/task.html", request=request)
Beispiel #18
0
def labeled(request, page=1):
    qs = Captcha.objects.filter(label_count__gt=2)
    pager = do_paginator(qs, page, 20)
    prefix = reverse("captcha.views.labeled")

    return render_template("captcha/labeled.html", request=request, pager=pager, prefix=prefix)
Beispiel #19
0
def hour(request):
    return render_template("clawer/monitor/hour.html", request=request)