Пример #1
0
def upload_file():
    if request.method == 'POST':
        if 'file' not in request.files:
            flash('No file part')
            return redirect(request.url)
        file = request.files['file']
        if file.filename == '':
            flash('No selected file')
            return redirect(request.url)
        if file and allowed_file(file.filename):
            ClaimServices.saveToDatabase(file)
            filename = secure_filename(file.filename)
            return redirect('/')
Пример #2
0
def getSnapshot():
    try:
        os.remove(app.static_folder + '\snapshot.json')
    except Exception as e:
        pass
    mode = request.args.get('type')
    path_to_file = ClaimServices.exportDatabase(mode)
    return send_file(path_to_file, as_attachment=True, cache_timeout=-1)
Пример #3
0
def getDashboard():
    if ClaimServices.databaseIsEmpty():
        return render_template("getting_started.html")
    analysis = ClaimServices.analysis()
    return render_template("home.html", analysis=analysis)
Пример #4
0
def getNeural():
    claim_id = request.args.get('id')
    print(claim_id)
    result = ClaimServices.getNeural(claim_id)
    return jsonify(result)
Пример #5
0
def getHistogram():
    histogram = ClaimServices.getHistogram()
    return jsonify({"histogram": histogram})
Пример #6
0
def getAnalysis():
    analysis = ClaimServices.analysis()
    analysis = json.dumps(analysis)
    analysis = json.loads(analysis)
    return jsonify(analysis)
Пример #7
0
def validateClaim():
    data = request.json
    ClaimServices.validateClaim(data['id'], data['credible'])
    return jsonify({"success": True})
Пример #8
0
def getAllClaims():
    claims = ClaimServices.getAllClaims()
    claims = json.dumps(claims)
    claims = json.loads(claims)
    return jsonify(claims)
Пример #9
0
def getUserCredAndModel():
    result = ClaimServices.getUserCredAndModel()
    return jsonify(result)