Omnibus commited on
Commit
94e11a4
·
1 Parent(s): 8e9df5c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -2
app.py CHANGED
@@ -379,6 +379,7 @@ def issue_tokens(send,rec,amount):
379
  response_rec, show_chain_rec, message_rec = mychain_mine_block_rec(balance_rec, chain_r=None,chain_n=rec)
380
  mes = (f'Send: {message_send} :: Recieve: {message_rec}')
381
  update_send_list()
 
382
  return (mes, p, response_send, response_rec, show_chain_send, show_chain_rec, data_send, data_rec, message_send, message_rec)
383
  ############################## MYCHAIN END ###############################
384
 
@@ -416,7 +417,20 @@ def update_send_list():
416
  send_list.append(ea.split("/",1)[1].split(".",1)[0])
417
  except Exception:
418
  pass
419
- upate_send_list()
 
 
 
 
 
 
 
 
 
 
 
 
 
420
 
421
  with gr.Blocks() as bc:
422
  with gr.Row(visible=True) as invalid:
@@ -437,7 +451,7 @@ with gr.Blocks() as bc:
437
  create_bc = gr.Button("Create New Blockchain")
438
  #send=gr.Textbox(label="Sender")
439
  send = gr.Dropdown(label="Sender", choices=[f for f in send_list], value = "Bank")
440
- rec=gr.Textbox(label="Recipient")
441
  am=gr.Textbox(label="Amount")
442
  send_trans=gr.Button("Post Transaction")
443
  mine_b = gr.Button("Mine Block")
 
379
  response_rec, show_chain_rec, message_rec = mychain_mine_block_rec(balance_rec, chain_r=None,chain_n=rec)
380
  mes = (f'Send: {message_send} :: Recieve: {message_rec}')
381
  update_send_list()
382
+ update_rec_list()
383
  return (mes, p, response_send, response_rec, show_chain_send, show_chain_rec, data_send, data_rec, message_send, message_rec)
384
  ############################## MYCHAIN END ###############################
385
 
 
417
  send_list.append(ea.split("/",1)[1].split(".",1)[0])
418
  except Exception:
419
  pass
420
+ update_send_list()
421
+
422
+ def update_rec_list():
423
+ f_ist = (api.list_repo_files(repo_id=f'{repo}/{name}', repo_type="dataset"))
424
+ rec_list =[]
425
+ for i,ea in enumerate(f_ist):
426
+ if "balance/" in ea:
427
+ try:
428
+ if not "__Source__" in ea:
429
+ rec_list.append(ea.split("/",1)[1].split(".",1)[0])
430
+ except Exception:
431
+ pass
432
+ update_rec_list()
433
+
434
 
435
  with gr.Blocks() as bc:
436
  with gr.Row(visible=True) as invalid:
 
451
  create_bc = gr.Button("Create New Blockchain")
452
  #send=gr.Textbox(label="Sender")
453
  send = gr.Dropdown(label="Sender", choices=[f for f in send_list], value = "Bank")
454
+ rec=gr.Dropdown(label="Recipient", choices=[f for f in rec_list])
455
  am=gr.Textbox(label="Amount")
456
  send_trans=gr.Button("Post Transaction")
457
  mine_b = gr.Button("Mine Block")