Spaces:
Sleeping
Sleeping
Commit
·
9ad2a0e
1
Parent(s):
399c48b
changes to hide tabs until data is loaded
Browse files
app.py
CHANGED
@@ -294,15 +294,16 @@ with gr.Blocks(theme='aliabid94/new-theme') as demo:
|
|
294 |
openai_api_key = gr.Textbox(label = 'Please provide your OpenAI API Key:', type = 'password', placeholder = 'Note: To use the OpenAI API, you need a paid account')
|
295 |
api_key_output = gr.Textbox(label = 'Result')
|
296 |
load_button = gr.Button('Load TLS Protect Cloud Data')
|
297 |
-
with gr.
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
|
|
306 |
|
307 |
def load_data_submit(tlspc_api_key, open_api_key):
|
308 |
data_return = getData(tlspc_api_key,openai_api_key)
|
@@ -311,8 +312,7 @@ with gr.Blocks(theme='aliabid94/new-theme') as demo:
|
|
311 |
else:
|
312 |
return {
|
313 |
api_key_output: data_return,
|
314 |
-
|
315 |
-
create_graphs: gr.update(visible=True)
|
316 |
}
|
317 |
|
318 |
|
@@ -320,6 +320,6 @@ with gr.Blocks(theme='aliabid94/new-theme') as demo:
|
|
320 |
text_button.click(prompt_analyze_questions, inputs=prompt_questions, outputs=text_output)
|
321 |
chart_button.click(prompt_analyze_reporting, inputs=prompt_reporting, outputs=chart_output)
|
322 |
load_button.click(load_data_submit, inputs = [tlspc_api_key, openai_api_key],
|
323 |
-
outputs = [api_key_output,
|
324 |
|
325 |
demo.launch()
|
|
|
294 |
openai_api_key = gr.Textbox(label = 'Please provide your OpenAI API Key:', type = 'password', placeholder = 'Note: To use the OpenAI API, you need a paid account')
|
295 |
api_key_output = gr.Textbox(label = 'Result')
|
296 |
load_button = gr.Button('Load TLS Protect Cloud Data')
|
297 |
+
with gr.Tabs(visible=False) as hidden_tabs:
|
298 |
+
with gr.Tab("Answer Questions"):
|
299 |
+
#prompt_tlspc_key = gr.Textbox(label = 'Please provide your TLS Protect Cloud API Key:')
|
300 |
+
prompt_questions = gr.Textbox(label = 'Input prompt here:', placeholder = "Try something like 'What is the name of the issuing template that has been used to request the most certificates?'")
|
301 |
+
text_output = gr.Textbox(label = 'Response:')
|
302 |
+
text_button = gr.Button("Submit")
|
303 |
+
with gr.Tab("Create Graphs"):
|
304 |
+
prompt_reporting = gr.Textbox(label = 'Input prompt here:', placeholder = "Try something like 'Plot a line chart of certificate issuances over time'")
|
305 |
+
chart_output = gr.Plot(label = 'Output:')
|
306 |
+
chart_button = gr.Button("Submit")
|
307 |
|
308 |
def load_data_submit(tlspc_api_key, open_api_key):
|
309 |
data_return = getData(tlspc_api_key,openai_api_key)
|
|
|
312 |
else:
|
313 |
return {
|
314 |
api_key_output: data_return,
|
315 |
+
hidden_tabs: gr.update(visible=True),
|
|
|
316 |
}
|
317 |
|
318 |
|
|
|
320 |
text_button.click(prompt_analyze_questions, inputs=prompt_questions, outputs=text_output)
|
321 |
chart_button.click(prompt_analyze_reporting, inputs=prompt_reporting, outputs=chart_output)
|
322 |
load_button.click(load_data_submit, inputs = [tlspc_api_key, openai_api_key],
|
323 |
+
outputs = [api_key_output, hidden_tabs])
|
324 |
|
325 |
demo.launch()
|