area444 commited on
Commit
ac95d16
·
verified ·
1 Parent(s): 6e2b7cb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -14
app.py CHANGED
@@ -11,20 +11,10 @@ import os
11
  pd.set_option('display.max_columns', None)
12
  pd.set_option('display.max_rows', None)
13
 
14
-
15
  DATABRICKS_INSTANCE = 'https://136286767906206.6.gcp.databricks.com'
16
  ACCESS_TOKEN = os.getenv("ACCESS_TOKEN_")
17
  JOB_ID = os.getenv("JOB_ID_")
18
 
19
- #user_1 = os.getenv("USER_1_")
20
- #user_2 = os.getenv("USER_2_")
21
- #user_3 = os.getenv("USER_3_")
22
- #user_4 = os.getenv("USER_4_")
23
- #pass_1 = os.getenv("PASS_1_")
24
- #pass_2 = os.getenv("PASS_2_")
25
- #pass_3 = os.getenv("PASS_3_")
26
- #pass_4 = os.getenv("PASS_4_")
27
-
28
  # Function that controls the visibility of the panels
29
  def check_words(user_text, input_text):
30
  # If the entered text is "user" and "casa", show Panel 2 and hide Panel 1
@@ -147,7 +137,6 @@ def update_table(start_date, end_date, window):
147
  df = df_predictions.copy()
148
  return df
149
 
150
-
151
  def save_csv(file_name):
152
  global df # Use global variable
153
  if file_name:
@@ -156,7 +145,6 @@ def save_csv(file_name):
156
  else:
157
  return "Please set file name!"
158
 
159
-
160
  with gr.Blocks() as demo:
161
  # Create the first panel (visible from the start)
162
  with gr.Column(visible=True) as panel_1:
@@ -186,11 +174,13 @@ with gr.Blocks() as demo:
186
 
187
  btn_update.click(fn=update_table, inputs=[start_input, prediction_input, range_input], outputs=table_)
188
  #btn_saving.click(fn=save_csv, inputs=file_name_input, outputs=gr.Textbox(label="File Status:"))
189
-
 
 
 
190
 
191
  # Configure the buttons and the panel visibility
192
  btn_1.click(check_words, inputs=[user_text, input_text], outputs=[panel_2, panel_1, user_text, input_text]) # Hide Panel 1 and show Panel 2
193
 
194
-
195
  demo.launch()
196
 
 
11
  pd.set_option('display.max_columns', None)
12
  pd.set_option('display.max_rows', None)
13
 
 
14
  DATABRICKS_INSTANCE = 'https://136286767906206.6.gcp.databricks.com'
15
  ACCESS_TOKEN = os.getenv("ACCESS_TOKEN_")
16
  JOB_ID = os.getenv("JOB_ID_")
17
 
 
 
 
 
 
 
 
 
 
18
  # Function that controls the visibility of the panels
19
  def check_words(user_text, input_text):
20
  # If the entered text is "user" and "casa", show Panel 2 and hide Panel 1
 
137
  df = df_predictions.copy()
138
  return df
139
 
 
140
  def save_csv(file_name):
141
  global df # Use global variable
142
  if file_name:
 
145
  else:
146
  return "Please set file name!"
147
 
 
148
  with gr.Blocks() as demo:
149
  # Create the first panel (visible from the start)
150
  with gr.Column(visible=True) as panel_1:
 
174
 
175
  btn_update.click(fn=update_table, inputs=[start_input, prediction_input, range_input], outputs=table_)
176
  #btn_saving.click(fn=save_csv, inputs=file_name_input, outputs=gr.Textbox(label="File Status:"))
177
+
178
+ # Add a second button inside Panel 2 to hide the panel and show Panel 1 again
179
+ btn_2 = gr.Button("Logout", visible=True)
180
+ btn_2.click(hide_and_show_panel, outputs=[panel_2, panel_1]) # Hide Panel 2 and show Panel 1
181
 
182
  # Configure the buttons and the panel visibility
183
  btn_1.click(check_words, inputs=[user_text, input_text], outputs=[panel_2, panel_1, user_text, input_text]) # Hide Panel 1 and show Panel 2
184
 
 
185
  demo.launch()
186