Omnibus commited on
Commit
9d52a5f
·
1 Parent(s): a5a5b67

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -6,7 +6,9 @@ import json
6
  import os
7
  import requests
8
  from blockchain import Blockchain
9
- from mychain import MyChain
 
 
10
  from huggingface_hub import (create_repo,get_full_repo_name,upload_file,CommitOperationAdd,HfApi)
11
 
12
  main_chain='https://huggingface.co/datasets/Omnibus/blockchain-sim/raw/main/chains/'
@@ -408,7 +410,7 @@ def get_my_chain_send(sender_name=None):
408
  try:
409
  r = requests.get(f'{main_balance}{sender_name}.json')
410
  print (f'r={r.text}')
411
- mychain_send = MyChain(chain_load=main_balance,load=r.text)
412
  response = {'chain': mychain_send.chain,
413
  'length': len(mychain_send.chain)}
414
  print (f'response={response}')
@@ -423,14 +425,14 @@ def get_my_chain_rec(recipient_name=None):
423
 
424
  try:
425
  r = requests.get(f'{main_balance}{recipient_name}.json')
426
- mychain_rec = MyChain(chain_load=main_balance,load=r.text)
427
  response = {'chain': mychain_rec.chain,
428
  'length': len(mychain_rec.chain)}
429
  message = f"Blockchain loaded from: {main_balance}{recipient_name}.json"
430
  return response,message
431
  except Exception:
432
  try:
433
- mychain_rec = MyChain(chain_load=main_balance,create=recipient_name)
434
  response = mychain_rec.chain
435
  message = f"Blockchain loaded from: {main_balance}{recipient_name}.json"
436
  return response,message
 
6
  import os
7
  import requests
8
  from blockchain 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/'
 
410
  try:
411
  r = requests.get(f'{main_balance}{sender_name}.json')
412
  print (f'r={r.text}')
413
+ mychain_send = MyChainSend(chain_load=main_balance,load=r.text)
414
  response = {'chain': mychain_send.chain,
415
  'length': len(mychain_send.chain)}
416
  print (f'response={response}')
 
425
 
426
  try:
427
  r = requests.get(f'{main_balance}{recipient_name}.json')
428
+ mychain_rec = MyChainRec(chain_load=main_balance,load=r.text)
429
  response = {'chain': mychain_rec.chain,
430
  'length': len(mychain_rec.chain)}
431
  message = f"Blockchain loaded from: {main_balance}{recipient_name}.json"
432
  return response,message
433
  except Exception:
434
  try:
435
+ mychain_rec = MyChainRec(chain_load=main_balance,create=recipient_name)
436
  response = mychain_rec.chain
437
  message = f"Blockchain loaded from: {main_balance}{recipient_name}.json"
438
  return response,message