コード例 #1
0
ファイル: app.py プロジェクト: pratiks14/newbankapp
def payment(accounttype,number):
	if request.method == 'POST':
		try:
			params = json.loads(request.data.decode('utf-8'))
			Operations.validatePayment(params)
			response = make_response(json.dumps("Payment Successful"), 200)
			response.headers['Content-Type'] = 'application/json'
			return response
		except Exception as e:
			# print(e)
			traceback.print_exc()
			response = make_response(json.dumps(str(e)), 400)
			response.headers['Content-Type'] = 'application/json'
			return response
	else:
		accounts = Operations.getSavingsAccounts()
		debtAccount=  Operations.getDebtAccount(accounttype,number)
		return render_template('payments.html',accounts=accounts,debtAccount=debtAccount)
コード例 #2
0
ファイル: app.py プロジェクト: pratiks14/newbankapp
def rendermain():
	if "username" not in login_session:
		return redirect('/')
	customerDetailsDict = {}
	try:
		customerDetailsDict = Operations.getCustomerDetailsDict(login_session['ssn'])
		customerDetailsDict['error'] = 'No'

	except Exception as e:
		print(e)
		traceback.print_exc()
		customerDetailsDict['error'] = 'error'
	return render_template('index.html',customerDetails = customerDetailsDict)
コード例 #3
0
ファイル: app.py プロジェクト: pratiks14/newbankapp
def moneytransfer():
	if request.method== 'GET':
		if "username" not in login_session:
			return redirect('/')
		accounts = Operations.getSavingsAccounts()

		return render_template('moneytransfer.html',accounts = accounts)
	else:
		try:
			params = request.form
			resp = Operations.moneyTransferValidate(params)
			if resp != None:
				return resp
			Operations.transferAmount(params)
			response = make_response(json.dumps('Transfer Completed'), 200)
			response.headers['Content-Type'] = 'application/json'
			return response
		except Exception as e:
			traceback.print_exc()
			response = make_response(json.dumps('Some Error Occured! Refresh and Try again '), 400)
			response.headers['Content-Type'] = 'application/json'
			return response
コード例 #4
0
ファイル: app.py プロジェクト: pratiks14/newbankapp
def login():
	if request.method == 'POST':
		try:
			params = json.loads(request.data.decode('utf-8'))
			resp = Operations.loginValidate(params)
			return resp
		except Exception as e:
			traceback.print_exc()
			response = make_response(json.dumps('Some Error Occured! Refresh and Try again '), 400)
			response.headers['Content-Type'] = 'application/json'
			return response


	return render_template('login.html')
コード例 #5
0
ファイル: app.py プロジェクト: pratiks14/newbankapp
def accounts(accounttype,accountno):
	if "username" not in login_session:
		return redirect('/')
	try:
		if request.method == 'GET':
			detailsDict = Operations.getAccountDetails(accounttype,accountno)
			# response = make_response(json.dumps(detailsDict), 400)
			# response.headers['Content-Type'] = 'application/json'
			return render_template('cardDetails.html',details = detailsDict)
	except Exception as e:
		print(e)
		traceback.print_exc()
		response = make_response(json.dumps('Some Error Occured! Refresh and Try again '), 400)
		response.headers['Content-Type'] = 'application/json'
		return response
コード例 #6
0
ファイル: app.py プロジェクト: pratiks14/newbankapp
def transactions(accounttype,accountno):
	try:
		data = request.args
		startdate = time.strptime(data['startdate'],'%m/%d/%Y')
		enddate = time.strptime(data['enddate'],'%m/%d/%Y')
		transactionDict = Operations.getTransactions(accounttype,accountno,startdate,enddate)
		response = make_response(json.dumps(transactionDict), 200)
		response.headers['Content-Type'] = 'application/json'
		return response
	except ValueError:
		response = make_response(json.dumps('Invalid Date Input '), 400)
		response.headers['Content-Type'] = 'application/json'
		return response
	except Exception as e:
		traceback.print_exc()
		response = make_response(json.dumps('Some Error Occured! Refresh and Try again '), 400)
		response.headers['Content-Type'] = 'application/json'
		return response
コード例 #7
0
ファイル: app.py プロジェクト: pratiks14/newbankapp
def register():
	if request.method == 'POST':
		try:
			params = request.form
			# print(params['registerno'])
			resp = Operations.validate(params)
			return resp

		except Exception as e:
			print(e)
			traceback.print_exc()
			response = make_response(json.dumps('Error'), 400)
			response.headers['Content-Type'] = 'application/json'
			return response
	if request.method == 'DELETE':
		params = json.loads(request.data.decode('utf-8'))
		securitynumber = params['securitynumber']


	return render_template('register.html')
コード例 #8
0
    train_doc_ids=mapping_to_ids(train_examples,char2id,label2id,relation2id,max_seq_len=config.max_seq_len)
    dev_doc_ids=mapping_to_ids(dev_examples,char2id,label2id,relation2id,max_seq_len=config.max_seq_len)

    tf.logging.info("训练集样本数量:%d" % len(train_doc_ids))
    tf.logging.info("验证集样本数量:%d" % len(dev_doc_ids))
    tf.logging.info("the example of train")
    tf.logging.info("token:%s"%str(train_doc_ids[0][0]))
    tf.logging.info("token_id:%s"%str(train_doc_ids[0][1]))
    tf.logging.info("ner_id:%s"%str(train_doc_ids[0][2]))

    with tf.Session(config=tf.ConfigProto(allow_soft_placement=True)) as sess:
        model=Model(config,embed_matrix,sess)
        #构建Graph
        loss_total, token, ner_ids, predNER, rel_true, predRel, relScore, params=model.run()
        train_op=model._get_train_op(loss_total)
        operations=Operations(train_op,loss_total,params,token,predNER,ner_ids,predRel,rel_true,relScore)

        #初始化
        saver = tf.train.Saver()
        sess.run(tf.global_variables_initializer())

        for iter in range(config.epoches):
            train(train_doc_ids,config,operations,iter,sess,id2label=id2label,id2relation=id2relation)
            dev(dev_doc_ids,config,operations,sess,id2relation=id2relation,id2label=id2label)

            if (iter+1)%5==0:
                path=saver.save(sess,"output/model.ckpt")
                print("模型已经保存,路径地址:",path)

        print("开始进行测试集输出.......")
        # saver.restore(sess,"./output/")