Omnibus commited on
Commit
853f578
·
verified ·
1 Parent(s): 22c4aac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -393,13 +393,13 @@ def find_rss():
393
  yield out_box,[(None,f'Source is current as of:\n{timestamp} UTC\n\nThe current Date and Time is:\n{timestamp} UTC')]
394
 
395
 
396
- def load_data(inp=None):
397
  timestamp=str(datetime.datetime.now())
398
  yield None,[(None,f'Loading data source, please wait')]
399
- if inp:
400
- yield None,[(None,f'Loading data from {inp}, please wait')]
401
 
402
- r = requests.get(f'{inp}')
403
  if r.status_code == 200:
404
  lod={}
405
  try:
@@ -419,7 +419,7 @@ def load_data(inp=None):
419
  yield lod,[(None,f'Source is current as of:\n{timestamp} UTC')]
420
  else:
421
  yield None, [(None, f'{rss_url} ::ERROR::COULD NOT CONNECT:: {r.status_code}')]
422
- if not inp:
423
  yield None,[(None,f'Loading data from database, please wait')]
424
 
425
  f_ist = (api.list_repo_files(repo_id=reponame, repo_type="dataset"))
@@ -442,9 +442,9 @@ with gr.Blocks() as app:
442
  inst = gr.Textbox(label="Instructions")
443
  sub_btn=gr.Button("Submit")
444
  with gr.Row():
445
- rss_custom=gr.Textbox("URL for RSS feed (.rss,.xml)")
446
  load_btn = gr.Button("Load RSS")
447
- with gr.Accordion():
448
  u_btn=gr.Button("Update [RSS Data]")
449
  keyw = gr.Button("Use Keyword [Experimental]")
450
  with gr.Row():
 
393
  yield out_box,[(None,f'Source is current as of:\n{timestamp} UTC\n\nThe current Date and Time is:\n{timestamp} UTC')]
394
 
395
 
396
+ def load_data(rss_url=None):
397
  timestamp=str(datetime.datetime.now())
398
  yield None,[(None,f'Loading data source, please wait')]
399
+ if rss_url:
400
+ yield None,[(None,f'Loading data from {rss_url}, please wait')]
401
 
402
+ r = requests.get(f'{rss_url}')
403
  if r.status_code == 200:
404
  lod={}
405
  try:
 
419
  yield lod,[(None,f'Source is current as of:\n{timestamp} UTC')]
420
  else:
421
  yield None, [(None, f'{rss_url} ::ERROR::COULD NOT CONNECT:: {r.status_code}')]
422
+ if not rss_url:
423
  yield None,[(None,f'Loading data from database, please wait')]
424
 
425
  f_ist = (api.list_repo_files(repo_id=reponame, repo_type="dataset"))
 
442
  inst = gr.Textbox(label="Instructions")
443
  sub_btn=gr.Button("Submit")
444
  with gr.Row():
445
+ rss_custom=gr.Textbox(label="URL for RSS feed (.rss,.xml)")
446
  load_btn = gr.Button("Load RSS")
447
+ with gr.Accordion(open=False):
448
  u_btn=gr.Button("Update [RSS Data]")
449
  keyw = gr.Button("Use Keyword [Experimental]")
450
  with gr.Row():