Omnibus commited on
Commit
7ceaf08
·
1 Parent(s): f7ad25a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -22
app.py CHANGED
@@ -7,6 +7,7 @@ pa=os.environ['PASS']
7
 
8
  main_chain='https://huggingface.co/datasets/Omnibus/chat-at/raw/main/chat/'
9
 
 
10
 
11
  def checkp(inp):
12
  if inp == pa:
@@ -66,36 +67,18 @@ with gr.Blocks() as app:
66
  gr.Column()
67
  def test_fn(im):
68
  return (im)
69
-
70
-
71
- def update_rec_list():
72
- f_ist = (api.list_repo_files(repo_id=f'{repo}/{name}', repo_type="dataset"))
73
- rec_list =[]
74
- for i,ea in enumerate(f_ist):
75
- if "balance/" in ea:
76
- try:
77
- if not "__Source__" in ea:
78
- rec_list.append(ea.split("/",1)[1].split(".",1)[0])
79
- except Exception:
80
- pass
81
- return rec_list, gr.Dropdown.update(label="Recipient", choices=[f for f in rec_list])
82
- rec_list, rec_drop = update_rec_list()
83
-
84
-
85
-
86
  def create_new_chain(address):
87
  address = str(address.strip("b").strip("'"))
88
  mychain_rec = chatchain.MyChainRec(chain_load=main_chain,create=address)
89
  response = {'chain': mychain_rec.chain,
90
  'length': len(mychain_rec.chain)}
91
-
92
  message = f"Blockchain loaded from: {main_chain}{address}.json"
93
  #send_list,send_drop = update_send_list()
94
- rec_list, rec_drop = update_rec_list()
95
-
96
- return response,message,rec_drop
 
97
  input_key.change(crypt.address,input_key,sender)
98
-
99
  pass_btn.click(checkp,pass_box,[invalid,valida])
100
 
101
  gen_wal_btn.click(crypt.generate_keys,None,[out2,out1,img3,out3,img1,img2]).then(create_new_chain,out1,[response_json,block_text,rec]).then(test_fn,[img1],[input_key])
 
7
 
8
  main_chain='https://huggingface.co/datasets/Omnibus/chat-at/raw/main/chat/'
9
 
10
+ rec_list, rec_drop = chatchain.update_rec_list()
11
 
12
  def checkp(inp):
13
  if inp == pa:
 
67
  gr.Column()
68
  def test_fn(im):
69
  return (im)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  def create_new_chain(address):
71
  address = str(address.strip("b").strip("'"))
72
  mychain_rec = chatchain.MyChainRec(chain_load=main_chain,create=address)
73
  response = {'chain': mychain_rec.chain,
74
  'length': len(mychain_rec.chain)}
 
75
  message = f"Blockchain loaded from: {main_chain}{address}.json"
76
  #send_list,send_drop = update_send_list()
77
+ rec_list, rec_drop = chatchain.update_rec_list()
78
+ return response,message,rec_drop
79
+
80
+
81
  input_key.change(crypt.address,input_key,sender)
 
82
  pass_btn.click(checkp,pass_box,[invalid,valida])
83
 
84
  gen_wal_btn.click(crypt.generate_keys,None,[out2,out1,img3,out3,img1,img2]).then(create_new_chain,out1,[response_json,block_text,rec]).then(test_fn,[img1],[input_key])