Omnibus commited on
Commit
a98591b
·
1 Parent(s): c5fb96d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -2
app.py CHANGED
@@ -394,8 +394,29 @@ def issue_tokens(send,rec,amount):
394
  #return (mes, p, response_send)
395
  ############################## MYCHAIN END ###############################
396
 
397
-
398
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
399
 
400
 
401
 
@@ -440,6 +461,7 @@ with gr.Blocks() as bc:
440
  with gr.Accordion("Tokens", open=False):
441
 
442
  issue_btn=gr.Button()
 
443
  out_box_bool=gr.Textbox()
444
  with gr.Row():
445
  with gr.Column():
@@ -452,6 +474,7 @@ with gr.Blocks() as bc:
452
  trans_data_rec = gr.Dataframe()
453
  json_out_rec = gr.Textbox()
454
  chain_json_rec = gr.JSON()
 
455
  issue_btn.click(issue_tokens,[send,rec,am],[block_text,out_box_bool,json_out_send,json_out_rec,chain_json_send,chain_json_rec,trans_data_send,trans_data_rec,block_text_send,block_text_rec])
456
  #issue_btn.click(issue_tokens,[send,rec,am],[block_text,out_box_bool,json_out_send])
457
 
 
394
  #return (mes, p, response_send)
395
  ############################## MYCHAIN END ###############################
396
 
397
+ def res_source():
398
+ block = {'index': 1,
399
+ 'timestamp': str(datetime.datetime.now()),
400
+ 'transactions': [],
401
+ 'balanace': 10000000000000000000,
402
+ 'proof': 1,
403
+ 'previous_hash': 0}
404
+
405
+ pending_transactions_x = []
406
+ pending_transactions_x.append(block)
407
+ json_object = json.dumps(pending_transactions_x, indent=4)
408
+ with open("tmp_send.json", "w") as outfile:
409
+ outfile.write(json_object)
410
+ try:
411
+ api.upload_file(
412
+ path_or_fileobj="tmp_send.json",
413
+ path_in_repo="balances/__Source__.json",
414
+ repo_id=main_balance.split('datasets/',1)[1].split('/raw',1)[0],
415
+ token=token_self,
416
+ repo_type="dataset",
417
+ )
418
+ os.remove("tmp_send.json")
419
+
420
 
421
 
422
 
 
461
  with gr.Accordion("Tokens", open=False):
462
 
463
  issue_btn=gr.Button()
464
+ reset_source=gr.Button()
465
  out_box_bool=gr.Textbox()
466
  with gr.Row():
467
  with gr.Column():
 
474
  trans_data_rec = gr.Dataframe()
475
  json_out_rec = gr.Textbox()
476
  chain_json_rec = gr.JSON()
477
+ reset_source.click(res_source,None,block_text)
478
  issue_btn.click(issue_tokens,[send,rec,am],[block_text,out_box_bool,json_out_send,json_out_rec,chain_json_send,chain_json_rec,trans_data_send,trans_data_rec,block_text_send,block_text_rec])
479
  #issue_btn.click(issue_tokens,[send,rec,am],[block_text,out_box_bool,json_out_send])
480