Severian commited on
Commit
f19b97c
·
verified ·
1 Parent(s): 3fecdf7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -22
app.py CHANGED
@@ -421,7 +421,7 @@ def get_dropdown_choices(info_dict):
421
 
422
  def login(username, password):
423
  if username == USERNAME and password == PASSWORD:
424
- return gr.update(visible=True), gr.update(visible=False), gr.update(visible=False), gr.update(value="Login successful! You can now access the QR Code Art Generator tab.", visible=True)
425
  else:
426
  return gr.update(visible=False), gr.update(visible=True), gr.update(visible=True), gr.update(value="Invalid username or password. Please try again.", visible=True)
427
 
@@ -449,27 +449,28 @@ with gr.Blocks(theme="Hev832/Applio", css=css, fill_width=True, fill_height=True
449
  """
450
  )
451
 
452
- with gr.Column(scale=1):
453
- with gr.Row():
454
- gr.Markdown(
455
- """
456
- Login below using the internal<br>
457
- username and password to access the full app.<br>
458
-
459
- Once logged in, a new tab will appear named<br>
460
- "QR Code Art Generator" allowing you to access.
461
- """
462
- )
463
-
464
- with gr.Row():
465
- username = gr.Textbox(label="Username", placeholder="Enter your username", value="ugd")
466
- with gr.Row():
467
- password = gr.Textbox(label="Password", type="password", placeholder="Enter your password", value="ugd!")
468
- with gr.Row():
469
- login_button = gr.Button("Login", size="sm")
470
- login_message = gr.Markdown(visible=False)
471
-
472
- with gr.Tab("Caption Captain") as app_container:
 
473
  with gr.Accordion("How to Use Caption Captain", open=False):
474
  gr.Markdown("""
475
  # How to Use Caption Captain
@@ -596,6 +597,11 @@ with gr.Blocks(theme="Hev832/Applio", css=css, fill_width=True, fill_height=True
596
  outputs=[error_message, output_caption]
597
  )
598
 
 
 
 
 
 
599
 
600
  if __name__ == "__main__":
601
  demo.launch()
 
421
 
422
  def login(username, password):
423
  if username == USERNAME and password == PASSWORD:
424
+ return gr.update(visible=True), gr.update(visible=False), gr.update(visible=False), gr.update(value="Login successful! You can now access the Caption Captain tab.", visible=True)
425
  else:
426
  return gr.update(visible=False), gr.update(visible=True), gr.update(visible=True), gr.update(value="Invalid username or password. Please try again.", visible=True)
427
 
 
449
  """
450
  )
451
 
452
+ with gr.Column(scale=1):
453
+ with gr.Row():
454
+ gr.Markdown(
455
+ """
456
+ Login below using the internal<br>
457
+ username and password to access the full app.<br>
458
+
459
+ Once logged in, a new tab will appear named<br>
460
+ "Caption Captain" allowing you to access the app.
461
+ """
462
+ )
463
+
464
+ with gr.Row():
465
+ username = gr.Textbox(label="Username", placeholder="Enter your username")
466
+ with gr.Row():
467
+ password = gr.Textbox(label="Password", type="password", placeholder="Enter your password")
468
+ with gr.Row():
469
+ login_button = gr.Button("Login", size="sm")
470
+ login_message = gr.Markdown(visible=False)
471
+
472
+ caption_captain_tab = gr.Tab("Caption Captain", visible=False)
473
+ with caption_captain_tab:
474
  with gr.Accordion("How to Use Caption Captain", open=False):
475
  gr.Markdown("""
476
  # How to Use Caption Captain
 
597
  outputs=[error_message, output_caption]
598
  )
599
 
600
+ login_button.click(
601
+ login,
602
+ inputs=[username, password],
603
+ outputs=[caption_captain_tab, username, password, login_message]
604
+ )
605
 
606
  if __name__ == "__main__":
607
  demo.launch()