Omnibus commited on
Commit
0ed4f05
·
verified ·
1 Parent(s): 835c636

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -303,15 +303,20 @@ def find_rss():
303
  token=token_self,
304
  repo_type="dataset",
305
  )
306
- yield out_box,[(None,'Sources are loaded. You can ask a question about them now.')]
307
 
308
  def load_data():
 
 
309
  f_ist = (api.list_repo_files(repo_id=reponame, repo_type="dataset"))
310
  f_ist.sort(reverse=True)
311
  print(f_ist)
312
  r = requests.get(f'{save_data}{f_ist[0]}')
313
  lod = json.loads(r.text)
314
- return lod
 
 
 
315
  with gr.Blocks() as app:
316
  cb = gr.Chatbot(height=500)
317
  with gr.Row():
@@ -323,7 +328,7 @@ with gr.Blocks() as app:
323
  with gr.Row():
324
  out_json = gr.JSON()
325
  fil = gr.Textbox()
326
- load_btn.click(load_data,None,out_json)
327
  u_btn.click(find_rss,None,[out_json,cb])
328
  sub_btn.click(summarize,[inst,cb,out_json],[inst,cb])
329
  app.launch()
 
303
  token=token_self,
304
  repo_type="dataset",
305
  )
306
+ yield out_box,[(None,f'Source is current as of:\n{timestamp} UTC\n\nThe current Date and Time is:\n{timestamp} UTC')]
307
 
308
  def load_data():
309
+ yield out_box,[(None,f'Loading data source, please wait')]
310
+
311
  f_ist = (api.list_repo_files(repo_id=reponame, repo_type="dataset"))
312
  f_ist.sort(reverse=True)
313
  print(f_ist)
314
  r = requests.get(f'{save_data}{f_ist[0]}')
315
  lod = json.loads(r.text)
316
+ timestamp=str(datetime.datetime.now())
317
+ timename=timestamp.replace("--"," ").replace("-"[0],":").replace("-"[1],".")
318
+ yield out_box,[(None,f'Source is current as of:\n{timename} UTC\n\nThe current Date and Time is:\n{timestamp} UTC')]
319
+
320
  with gr.Blocks() as app:
321
  cb = gr.Chatbot(height=500)
322
  with gr.Row():
 
328
  with gr.Row():
329
  out_json = gr.JSON()
330
  fil = gr.Textbox()
331
+ load_btn.click(load_data,None,[out_json,cb])
332
  u_btn.click(find_rss,None,[out_json,cb])
333
  sub_btn.click(summarize,[inst,cb,out_json],[inst,cb])
334
  app.launch()