hra commited on
Commit
927f2a3
1 Parent(s): 8290414

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -16,6 +16,9 @@ def getstuff(openapikey,category_selector):
16
  dateforfilesave=datetime.today().strftime("%d-%m-%Y %I:%M%p")
17
  print(category_selector)
18
  print(dateforfilesave)
 
 
 
19
  os.environ['OPENAI_API_KEY'] = str(openapikey)
20
 
21
  RssReader = download_loader("RssReader")
@@ -83,12 +86,14 @@ with gr.Blocks() as demo:
83
 
84
  with gr.Row() as row:
85
  with gr.Column():
86
- textboxopenapi = gr.Textbox(placeholder="Enter OpenAPI Key...", lines=1,label='OpenAPI Key')
87
  category_selector=gr.Dropdown(
88
  listofcategories, label="Sector Options", info="Select the snapshot you want..."
89
  )
90
  with gr.Column():
91
- btn = gr.Button("Generate \nSnapshot")
 
 
 
92
 
93
  with gr.Row() as row:
94
  table1=gr.Dataframe(
 
16
  dateforfilesave=datetime.today().strftime("%d-%m-%Y %I:%M%p")
17
  print(category_selector)
18
  print(dateforfilesave)
19
+ if openapikey=='':
20
+ return pd.DataFrame(["Please provide OpenAPI Key"],columns=['ERROR']),pd.DataFrame(["Please provide OpenAPI Key"],columns=['ERROR']),'Error: Please provide OpenAPI key','Error: Please provide OpenAPI key'
21
+
22
  os.environ['OPENAI_API_KEY'] = str(openapikey)
23
 
24
  RssReader = download_loader("RssReader")
 
86
 
87
  with gr.Row() as row:
88
  with gr.Column():
 
89
  category_selector=gr.Dropdown(
90
  listofcategories, label="Sector Options", info="Select the snapshot you want..."
91
  )
92
  with gr.Column():
93
+ textboxopenapi = gr.Textbox(placeholder="Enter OpenAPI Key...", lines=1,label='OpenAPI Key')
94
+
95
+ with gr.Column():
96
+ btn = gr.Button("Generate \nSnapshot")
97
 
98
  with gr.Row() as row:
99
  table1=gr.Dataframe(