Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -9,6 +9,7 @@ from mychain import Blockchain
|
|
9 |
from mychain import MyChainSend
|
10 |
from mychain import MyChainRec
|
11 |
from mychain import MyChainTrans
|
|
|
12 |
|
13 |
from huggingface_hub import (create_repo,get_full_repo_name,upload_file,CommitOperationAdd,HfApi)
|
14 |
|
@@ -163,11 +164,7 @@ def get_chain(repo_name=None,chain_name=None,token=None):
|
|
163 |
except:
|
164 |
message = f"Error loading from: {src}"
|
165 |
return ["Error Loading Chain"],message
|
166 |
-
|
167 |
-
if inp == pa:
|
168 |
-
return gr.update(visible=False), gr.update(visible=True)
|
169 |
-
elif inp != pa:
|
170 |
-
return gr.update(visible=True), gr.update(visible=False)
|
171 |
def add_node(this_space,repo,space,chain_file):
|
172 |
#print(f"{api.whoami(['name'])}")
|
173 |
#repo = f'omnibus/{space}'
|
@@ -210,6 +207,13 @@ name = main_balance.split('datasets/',1)[1].split('/raw',1)[0].split('/',1)[1]
|
|
210 |
|
211 |
|
212 |
############################## BLOCKCHAIN END ###############################
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
############################## MYCHAIN START ###############################
|
214 |
|
215 |
|
@@ -436,7 +440,7 @@ def issue_tokens(send,rec,amount):
|
|
436 |
balance_rec = 0
|
437 |
mes = "blank message"
|
438 |
try:
|
439 |
-
b_mes,z=valid()
|
440 |
if z == True:
|
441 |
try:
|
442 |
response,message = get_my_chain_send(send)
|
@@ -526,7 +530,7 @@ def issue_tokens(send,rec,amount):
|
|
526 |
_,rec_send=update_send_list()
|
527 |
_,rec_drop=update_rec_list()
|
528 |
trans_bx = merge_trans()
|
529 |
-
trans_data, mes = bc_transactions(trans_bx)
|
530 |
return (mes, p, response_send, response_rec, show_chain_send, show_chain_rec, data_send, data_rec, message_send, message_rec, rec_send, rec_drop,trans_data)
|
531 |
|
532 |
|
@@ -706,15 +710,15 @@ with gr.Blocks() as bc:
|
|
706 |
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,send,rec,trans_data])
|
707 |
#issue_btn.click(issue_tokens,[send,rec,am],[block_text,out_box_bool,json_out_send])
|
708 |
|
709 |
-
node_add.click(add_node,[this_space,node_repo,node_space,node_file],block_text)
|
710 |
pass_btn.click(checkp,pass_box,[invalid,valida])
|
711 |
-
in_chain_btn.click(get_chain,[chain_repo,chain_n],[chain_json,block_text])
|
712 |
-
create_bc.click(create_chain,[chain_n],[block_text,json_out,chain_json])
|
713 |
-
check.click(valid,None,[block_text,out_box_bool])
|
714 |
#check_all.click(sort_valid,None,block_text)
|
715 |
|
716 |
#send_trans.click(bc_transactions,[send,rec,am],[trans_data,block_text,send,rec,am])
|
717 |
-
mine_b.click(mine_block,[chain_repo,chain_n],[json_out,chain_json,trans_data,block_text])
|
718 |
|
719 |
|
720 |
bc.launch(enable_queue=False)
|
|
|
9 |
from mychain import MyChainSend
|
10 |
from mychain import MyChainRec
|
11 |
from mychain import MyChainTrans
|
12 |
+
import bc_utils
|
13 |
|
14 |
from huggingface_hub import (create_repo,get_full_repo_name,upload_file,CommitOperationAdd,HfApi)
|
15 |
|
|
|
164 |
except:
|
165 |
message = f"Error loading from: {src}"
|
166 |
return ["Error Loading Chain"],message
|
167 |
+
|
|
|
|
|
|
|
|
|
168 |
def add_node(this_space,repo,space,chain_file):
|
169 |
#print(f"{api.whoami(['name'])}")
|
170 |
#repo = f'omnibus/{space}'
|
|
|
207 |
|
208 |
|
209 |
############################## BLOCKCHAIN END ###############################
|
210 |
+
|
211 |
+
def checkp(inp):
|
212 |
+
if inp == pa:
|
213 |
+
return gr.update(visible=False), gr.update(visible=True)
|
214 |
+
elif inp != pa:
|
215 |
+
return gr.update(visible=True), gr.update(visible=False)
|
216 |
+
|
217 |
############################## MYCHAIN START ###############################
|
218 |
|
219 |
|
|
|
440 |
balance_rec = 0
|
441 |
mes = "blank message"
|
442 |
try:
|
443 |
+
b_mes,z=bc_utils.valid()
|
444 |
if z == True:
|
445 |
try:
|
446 |
response,message = get_my_chain_send(send)
|
|
|
530 |
_,rec_send=update_send_list()
|
531 |
_,rec_drop=update_rec_list()
|
532 |
trans_bx = merge_trans()
|
533 |
+
trans_data, mes = bc_utils.bc_transactions(trans_bx)
|
534 |
return (mes, p, response_send, response_rec, show_chain_send, show_chain_rec, data_send, data_rec, message_send, message_rec, rec_send, rec_drop,trans_data)
|
535 |
|
536 |
|
|
|
710 |
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,send,rec,trans_data])
|
711 |
#issue_btn.click(issue_tokens,[send,rec,am],[block_text,out_box_bool,json_out_send])
|
712 |
|
713 |
+
node_add.click(bc_utils.add_node,[this_space,node_repo,node_space,node_file],block_text)
|
714 |
pass_btn.click(checkp,pass_box,[invalid,valida])
|
715 |
+
in_chain_btn.click(bc_utils.get_chain,[chain_repo,chain_n],[chain_json,block_text])
|
716 |
+
create_bc.click(bc_utils.create_chain,[chain_n],[block_text,json_out,chain_json])
|
717 |
+
check.click(bc_utils.valid,None,[block_text,out_box_bool])
|
718 |
#check_all.click(sort_valid,None,block_text)
|
719 |
|
720 |
#send_trans.click(bc_transactions,[send,rec,am],[trans_data,block_text,send,rec,am])
|
721 |
+
mine_b.click(bc_utils.mine_block,[chain_repo,chain_n],[json_out,chain_json,trans_data,block_text])
|
722 |
|
723 |
|
724 |
bc.launch(enable_queue=False)
|