Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -1442,12 +1442,9 @@ def login(username, password):
|
|
1442 |
|
1443 |
def toggle_login_signup(show_login):
|
1444 |
if show_login:
|
1445 |
-
return gr.update(visible=True), gr.update(visible=False)
|
1446 |
else:
|
1447 |
-
return gr.update(visible=False), gr.update(visible=True)
|
1448 |
-
|
1449 |
-
def close_forms():
|
1450 |
-
return gr.update(visible=False), gr.update(visible=False)
|
1451 |
|
1452 |
def toggle_login_logout(is_logged_in):
|
1453 |
if is_logged_in:
|
@@ -1460,7 +1457,7 @@ with gr.Blocks(theme='Pijush2023/scikit-learn-pijush') as demo:
|
|
1460 |
|
1461 |
def toggle_login_status(is_logged_in):
|
1462 |
is_logged_in = not is_logged_in
|
1463 |
-
return gr.update(value=toggle_login_logout(is_logged_in)), is_logged_in
|
1464 |
|
1465 |
with gr.Row():
|
1466 |
with gr.Column():
|
@@ -1512,9 +1509,11 @@ with gr.Blocks(theme='Pijush2023/scikit-learn-pijush') as demo:
|
|
1512 |
login_password = gr.Textbox(placeholder="Password", type="password")
|
1513 |
login_form_button = gr.Button("Login")
|
1514 |
login_message = gr.Textbox(interactive=False)
|
1515 |
-
login_form_button.click(fn=login, inputs=[login_username, login_password], outputs=[login_message])
|
1516 |
-
|
1517 |
-
|
|
|
|
|
1518 |
|
1519 |
signup_form = gr.Column(visible=False)
|
1520 |
with signup_form:
|
@@ -1524,12 +1523,14 @@ with gr.Blocks(theme='Pijush2023/scikit-learn-pijush') as demo:
|
|
1524 |
signup_password_confirmation = gr.Textbox(placeholder="Confirm Password", type="password")
|
1525 |
signup_form_button = gr.Button("Signup")
|
1526 |
signup_message = gr.Textbox(interactive=False)
|
1527 |
-
signup_form_button.click(fn=signup, inputs=[signup_username, signup_password, signup_password_confirmation], outputs=[signup_message])
|
1528 |
-
|
1529 |
-
|
|
|
|
|
1530 |
|
1531 |
-
login_form_button.click(fn=toggle_login_status, inputs=[is_logged_in], outputs=[login_button, is_logged_in
|
1532 |
-
|
1533 |
|
1534 |
demo.queue()
|
1535 |
demo.launch(share=True)
|
|
|
1442 |
|
1443 |
def toggle_login_signup(show_login):
|
1444 |
if show_login:
|
1445 |
+
return gr.update(visible=True), gr.update(visible=False)
|
1446 |
else:
|
1447 |
+
return gr.update(visible=False), gr.update(visible=True)
|
|
|
|
|
|
|
1448 |
|
1449 |
def toggle_login_logout(is_logged_in):
|
1450 |
if is_logged_in:
|
|
|
1457 |
|
1458 |
def toggle_login_status(is_logged_in):
|
1459 |
is_logged_in = not is_logged_in
|
1460 |
+
return gr.update(value=toggle_login_logout(is_logged_in)), is_logged_in
|
1461 |
|
1462 |
with gr.Row():
|
1463 |
with gr.Column():
|
|
|
1509 |
login_password = gr.Textbox(placeholder="Password", type="password")
|
1510 |
login_form_button = gr.Button("Login")
|
1511 |
login_message = gr.Textbox(interactive=False)
|
1512 |
+
login_form_button.click(fn=login, inputs=[login_username, login_password], outputs=[login_message, login_form, signup_button]).then(
|
1513 |
+
fn=lambda: (gr.update(visible=False), gr.update(visible=False), gr.update(value="Logout")), inputs=None, outputs=[login_form, signup_form, login_button]
|
1514 |
+
)
|
1515 |
+
gr.Button("Close").click(fn=lambda: gr.update(visible=False), inputs=None, outputs=login_form)
|
1516 |
+
login_button.click(fn=toggle_login_signup, inputs=[gr.State(True)], outputs=[login_form, signup_form])
|
1517 |
|
1518 |
signup_form = gr.Column(visible=False)
|
1519 |
with signup_form:
|
|
|
1523 |
signup_password_confirmation = gr.Textbox(placeholder="Confirm Password", type="password")
|
1524 |
signup_form_button = gr.Button("Signup")
|
1525 |
signup_message = gr.Textbox(interactive=False)
|
1526 |
+
signup_form_button.click(fn=signup, inputs=[signup_username, signup_password, signup_password_confirmation], outputs=[signup_message, signup_form, signup_button]).then(
|
1527 |
+
fn=lambda: gr.update(visible=False), inputs=None, outputs=signup_form
|
1528 |
+
)
|
1529 |
+
gr.Button("Close").click(fn=lambda: gr.update(visible=False), inputs=None, outputs=signup_form)
|
1530 |
+
signup_button.click(fn=toggle_login_signup, inputs=[gr.State(False)], outputs=[signup_form, login_form])
|
1531 |
|
1532 |
+
login_form_button.click(fn=toggle_login_status, inputs=[is_logged_in], outputs=[login_button, is_logged_in])
|
1533 |
+
login_button.click(fn=toggle_login_status, inputs=[is_logged_in], outputs=[login_button, is_logged_in])
|
1534 |
|
1535 |
demo.queue()
|
1536 |
demo.launch(share=True)
|