コード例 #1
0
ファイル: app.py プロジェクト: everbrightw/CourseProject
def results(course_name=None, lno=None, slide_name=None, curr_slide=None):
    data = json.loads(request.data.decode('utf-8'))
    # print(1,1,data)
    querytext = data['searchString']
    explanation, file_names = model.get_explanation(querytext)
    if explanation == '':
        num_results = 0
    else:
        num_results = 1
    response = jsonify({'num_results': num_results, 'explanation': explanation, 'file_names': file_names})
    # print(response)
    return response
コード例 #2
0
def results(course_name=None, lno=None, slide_name=None, curr_slide=None):
    querytext = request.json.get("searchString", None)
    if not querytext:
        return jsonify({})
    explanation, file_names = model.get_explanation(querytext)
    if explanation == "":
        num_results = 0
    else:
        num_results = 1
    response = jsonify({
        "num_results": num_results,
        "explanation": explanation,
        "file_names": file_names,
    })
    # print(response)
    return response