waloneai commited on
Commit
adbd406
·
verified ·
1 Parent(s): 2ae8f2a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -285,10 +285,10 @@ def check_password(password):
285
  return password == PASSWORD
286
 
287
 
288
- # Gradio app with custom login system
289
  with gr.Blocks() as demo:
290
- # Login interface
291
- with gr.Row():
292
  password_input = gr.Textbox(label="Enter Password", type="password")
293
  login_button = gr.Button("Login")
294
  login_status = gr.Textbox(label="Login Status", interactive=False)
@@ -407,14 +407,14 @@ with gr.Blocks() as demo:
407
  # Show/hide main interface based on login status
408
  def toggle_interface(password):
409
  if check_password(password):
410
- return gr.update(visible=True), "Login successful!"
411
  else:
412
- return gr.update(visible=False), "Invalid password. Please try again."
413
 
414
  login_button.click(
415
  fn=toggle_interface,
416
  inputs=password_input,
417
- outputs=[main_interface, login_status],
418
  )
419
 
420
  # Launch the app with embedding enabled
 
285
  return password == PASSWORD
286
 
287
 
288
+ # Gradio app with password protection
289
  with gr.Blocks() as demo:
290
+ # Login interface (hidden by default)
291
+ with gr.Row(visible=True) as login_interface:
292
  password_input = gr.Textbox(label="Enter Password", type="password")
293
  login_button = gr.Button("Login")
294
  login_status = gr.Textbox(label="Login Status", interactive=False)
 
407
  # Show/hide main interface based on login status
408
  def toggle_interface(password):
409
  if check_password(password):
410
+ return gr.update(visible=False), gr.update(visible=True), "Login successful!"
411
  else:
412
+ return gr.update(visible=True), gr.update(visible=False), "Invalid password. Please try again."
413
 
414
  login_button.click(
415
  fn=toggle_interface,
416
  inputs=password_input,
417
+ outputs=[login_interface, main_interface, login_status],
418
  )
419
 
420
  # Launch the app with embedding enabled