コード例 #1
0
def search(request):
    if request.method == 'POST':
        qp = DVAPQLProcess()
        view_shared.create_query_from_request(qp, request)
        qp.launch()
        qp.wait_query()
        return JsonResponse(data={'url': '/queries/{}/'.format(qp.process.pk)})
    else:
        raise ValueError("Only POST method is valid")
コード例 #2
0
def search(request):
    if request.method == 'POST':
        qp = DVAPQLProcess()
        view_shared.create_query_from_request(qp, request)
        qp.launch()
        qp.wait_query()
        qp_context = view_shared.collect(qp)
        return JsonResponse(
            data={
                'task_id':
                "",
                'primary_key':
                qp.process.pk,
                'results':
                qp_context['results'],
                'regions':
                qp_context['regions'],
                'url':
                '{}queries/{}.png'.format(settings.MEDIA_URL, qp.process.uuid)
            })
コード例 #3
0
            'arguments': {
                'index':
                'inception',
                'target':
                'query',
                'map': [{
                    'operation': 'perform_retrieval',
                    'arguments': {
                        'count':
                        15,
                        'retriever_pk':
                        Retriever.objects.get(name='inception',
                                              algorithm=algo,
                                              approximator_shasum=None).pk
                    }
                }]
            }
        }, {
            'operation': 'perform_detection',
            'arguments': {
                'detector': 'coco',
                'target': 'query',
            }
        }]
    }
    qp = DVAPQLProcess()
    qp.create_from_json(query_dict)
    qp.launch()
    qp.wait_query(timeout=400)
    print QueryResults.objects.count()