Omnibus commited on
Commit
d904f7f
·
1 Parent(s): d859eb0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -1
app.py CHANGED
@@ -8,16 +8,20 @@ import requests
8
  from mychain import Blockchain
9
  from mychain import MyChainSend
10
  from mychain import MyChainRec
 
11
 
12
  from huggingface_hub import (create_repo,get_full_repo_name,upload_file,CommitOperationAdd,HfApi)
13
 
14
  main_chain='https://huggingface.co/datasets/Omnibus/blockchain-sim/raw/main/chains/'
15
  main_balance='https://huggingface.co/datasets/Omnibus/blockchain-sim/raw/main/balance/'
 
16
 
17
  main_nodes='https://huggingface.co/datasets/Omnibus/blockchain-sim/raw/main/node_file1.json'
18
  main_pending='https://huggingface.co/datasets/Omnibus/blockchain-sim/raw/main/pending1.json'
19
  token_self = os.environ['HF_TOKEN']
20
  pa=os.environ['PASS']
 
 
21
  repo_d='Omnibus/static-bin'
22
  chain_d='chain1.json'
23
  node_file='node_file.json'
@@ -212,14 +216,21 @@ name = main_balance.split('datasets/',1)[1].split('/raw',1)[0].split('/',1)[1]
212
 
213
  def get_my_chain_send(sender_name=None):
214
  global mychain_send
215
-
216
  try:
217
  r = requests.get(f'{main_balance}{sender_name}.json')
 
 
218
  #print (f'r={r.text}')
219
  mychain_send = MyChainSend(chain_load=main_balance,load=r.text)
 
220
  response = {'chain': mychain_send.chain,
221
  'length': len(mychain_send.chain)}
222
  #print (f'response={response}')
 
 
 
 
223
  message = f"Blockchain loaded from: {main_balance}{sender_name}.json"
224
  return response,message
225
  except Exception:
 
8
  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
 
15
  main_chain='https://huggingface.co/datasets/Omnibus/blockchain-sim/raw/main/chains/'
16
  main_balance='https://huggingface.co/datasets/Omnibus/blockchain-sim/raw/main/balance/'
17
+ main_trans='https://huggingface.co/datasets/Omnibus/blockchain-sim/raw/main/transact/'
18
 
19
  main_nodes='https://huggingface.co/datasets/Omnibus/blockchain-sim/raw/main/node_file1.json'
20
  main_pending='https://huggingface.co/datasets/Omnibus/blockchain-sim/raw/main/pending1.json'
21
  token_self = os.environ['HF_TOKEN']
22
  pa=os.environ['PASS']
23
+
24
+ trans_name = 'trans1.json'
25
  repo_d='Omnibus/static-bin'
26
  chain_d='chain1.json'
27
  node_file='node_file.json'
 
216
 
217
  def get_my_chain_send(sender_name=None):
218
  global mychain_send
219
+ global mychain_trans
220
  try:
221
  r = requests.get(f'{main_balance}{sender_name}.json')
222
+ d = requests.get(f'{main_trans}{trans_name}')
223
+
224
  #print (f'r={r.text}')
225
  mychain_send = MyChainSend(chain_load=main_balance,load=r.text)
226
+
227
  response = {'chain': mychain_send.chain,
228
  'length': len(mychain_send.chain)}
229
  #print (f'response={response}')
230
+ mychain_trans = MyChainTrans(chain_load=main_trans,load=d.text)
231
+
232
+
233
+
234
  message = f"Blockchain loaded from: {main_balance}{sender_name}.json"
235
  return response,message
236
  except Exception: