ASG Models commited on
Commit
bdbc08d
·
verified ·
1 Parent(s): 948e406

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -4
app.py CHANGED
@@ -249,6 +249,17 @@ class DataViewerApp:
249
  # self.txt_audio.update("") # Clear text input
250
 
251
  return self.get_page_data(self.current_page)
 
 
 
 
 
 
 
 
 
 
 
252
  def start_tab1(self):
253
  with gr.Blocks(theme=self.seafoam, css="""
254
  .checkbox-group label {
@@ -263,11 +274,22 @@ class DataViewerApp:
263
  font-weight: bold;
264
  }
265
  """) as demo:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
266
 
267
- with gr.Row(equal_height=False):
268
- with gr.Tabs():
269
- with gr.TabItem("Processing Data "):
270
- self.data_Processing()
271
  return demo
272
  def create_Tabs(self): # fix: method was missing
273
  #with gr.Blocks() as interface:
 
249
  # self.txt_audio.update("") # Clear text input
250
 
251
  return self.get_page_data(self.current_page)
252
+ def login(self, token):
253
+ # Your actual login logic here (e.g., database check)
254
+ if token == "admin" :
255
+ return gr.update(visible=False),gr.update(visible=True),True
256
+ else:
257
+ return gr.update(visible=True), gr.update(visible=False),None
258
+ def load_demo(self,sesion):
259
+ if sesion:
260
+ return gr.update(visible=False),gr.update(visible=True)
261
+
262
+ return gr.update(visible=True), gr.update(visible=False)
263
  def start_tab1(self):
264
  with gr.Blocks(theme=self.seafoam, css="""
265
  .checkbox-group label {
 
274
  font-weight: bold;
275
  }
276
  """) as demo:
277
+ sesion_state = gr.State(valor_inicial=None)
278
+
279
+ with gr.Column(scale=1, min_width=200,visible=True) as login_panal: # Login panel
280
+ gr.Markdown("## auth acess page")
281
+ token_login = gr.Textbox(label="token")
282
+
283
+ login_button = gr.Button("Login")
284
+ with gr.Column(scale=1, visible=False) as main_panel:
285
+ with gr.Row(equal_height=False):
286
+ with gr.Tabs():
287
+ with gr.TabItem("Processing Data "):
288
+ self.data_Processing()
289
+ login_button.click(self.login, inputs=[token_login], outputs=[login_panal,main_panel,sesion_state])
290
+ demo.load(self.load_demo, [sesion_state], [login_panal,main_panel])
291
+
292
 
 
 
 
 
293
  return demo
294
  def create_Tabs(self): # fix: method was missing
295
  #with gr.Blocks() as interface: