Omnibus commited on
Commit
94df3c5
·
1 Parent(s): 7bc31d0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -18
app.py CHANGED
@@ -12,8 +12,25 @@ pa=os.environ['PASS']
12
 
13
  main_chain='https://huggingface.co/datasets/Omnibus/chat-at/raw/main/chat/'
14
 
15
- rec_list,_ = chatchain.update_rec_list(main_chain)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
 
 
 
17
  def checkp(inp):
18
  if inp == pa:
19
  return gr.update(visible=False), gr.update(visible=True)
@@ -85,23 +102,7 @@ with gr.Blocks() as app:
85
  #rec_drop = gr.Dropdown.update(label="Recipient", choices=[f for f in rec_list])
86
  return response,message,rec_drop
87
 
88
- def update_rec_list():
89
- repo = main_chain.split('datasets/',1)[1].split('/raw',1)[0].split('/',1)[0]
90
- name = main_chain.split('datasets/',1)[1].split('/raw',1)[0].split('/',1)[1]
91
- f_ist = (api.list_repo_files(repo_id=f'{repo}/{name}', repo_type="dataset"))
92
- rec_list =[]
93
- for i,ea in enumerate(f_ist):
94
- if "chat/" in ea:
95
- try:
96
- if not "__Source__" in ea:
97
- rec_list.append(ea.split("/",1)[1].split("/",1)[0])
98
- except Exception:
99
- pass
100
- return rec_list, gr.Dropdown.update(label="Recipient", choices=[f for f in rec_list])
101
- rec_list, rec_drop = update_rec_list()
102
- def up_rec():
103
- _,rec_drop = update_rec_list()
104
- return rec_drop
105
 
106
  input_key.change(crypt.address,input_key,sender).then(up_rec,None,rec)
107
  pass_btn.click(checkp,pass_box,[invalid,valida])
 
12
 
13
  main_chain='https://huggingface.co/datasets/Omnibus/chat-at/raw/main/chat/'
14
 
15
+ #rec_list,_ = chatchain.update_rec_list(main_chain)
16
+ def update_rec_list():
17
+ repo = main_chain.split('datasets/',1)[1].split('/raw',1)[0].split('/',1)[0]
18
+ name = main_chain.split('datasets/',1)[1].split('/raw',1)[0].split('/',1)[1]
19
+ f_ist = (api.list_repo_files(repo_id=f'{repo}/{name}', repo_type="dataset"))
20
+ rec_list =[]
21
+ for i,ea in enumerate(f_ist):
22
+ if "chat/" in ea:
23
+ try:
24
+ if not "__Source__" in ea:
25
+ rec_list.append(ea.split("/",1)[1].split("/",1)[0])
26
+ except Exception:
27
+ pass
28
+ return rec_list, gr.Dropdown.update(label="Recipient", choices=[f for f in rec_list])
29
+ rec_list, rec_drop = update_rec_list()
30
 
31
+ def up_rec():
32
+ rec_list,rec_drop = update_rec_list()
33
+ return gr.Dropdown.update(label="Recipient", choices=[f for f in rec_list]
34
  def checkp(inp):
35
  if inp == pa:
36
  return gr.update(visible=False), gr.update(visible=True)
 
102
  #rec_drop = gr.Dropdown.update(label="Recipient", choices=[f for f in rec_list])
103
  return response,message,rec_drop
104
 
105
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
 
107
  input_key.change(crypt.address,input_key,sender).then(up_rec,None,rec)
108
  pass_btn.click(checkp,pass_box,[invalid,valida])