Spaces:
Running
Running
Update dashboard.py
Browse files- dashboard.py +16 -10
dashboard.py
CHANGED
|
@@ -105,8 +105,8 @@ GUIDE_TAB_NAME = "π User Guide"
|
|
| 105 |
with gr.Blocks(theme=gr.themes.Soft(), title="VerifiAI - Deepfake Detector") as demo:
|
| 106 |
is_logged_in = gr.State(False)
|
| 107 |
|
| 108 |
-
with gr.Tabs(
|
| 109 |
-
with gr.Tab(HOME_TAB_NAME) as home_tab:
|
| 110 |
with gr.Row():
|
| 111 |
with gr.Column():
|
| 112 |
gr.Markdown("""
|
|
@@ -118,7 +118,7 @@ with gr.Blocks(theme=gr.themes.Soft(), title="VerifiAI - Deepfake Detector") as
|
|
| 118 |
</div>
|
| 119 |
""", elem_id="home-markdown")
|
| 120 |
|
| 121 |
-
with gr.Tab(LOGIN_TAB_NAME) as login_tab:
|
| 122 |
with gr.Row():
|
| 123 |
with gr.Column(scale=1):
|
| 124 |
gr.Markdown("## Welcome!", "Login to access the detector, or sign up for a new account.")
|
|
@@ -165,16 +165,16 @@ with gr.Blocks(theme=gr.themes.Soft(), title="VerifiAI - Deepfake Detector") as
|
|
| 165 |
def update_ui_on_auth_change(logged_in_status):
|
| 166 |
if logged_in_status:
|
| 167 |
return (
|
| 168 |
-
gr.update(visible=False),
|
| 169 |
-
gr.update(visible=True),
|
| 170 |
-
gr.update(
|
| 171 |
gr.update(value="β
Login successful!", visible=True)
|
| 172 |
)
|
| 173 |
else:
|
| 174 |
return (
|
| 175 |
-
gr.update(visible=True),
|
| 176 |
-
gr.update(visible=False),
|
| 177 |
-
gr.update(
|
| 178 |
gr.update(value="", visible=False)
|
| 179 |
)
|
| 180 |
|
|
@@ -196,10 +196,16 @@ with gr.Blocks(theme=gr.themes.Soft(), title="VerifiAI - Deepfake Detector") as
|
|
| 196 |
|
| 197 |
login_btn.click(fn=handle_login, inputs=[email_login, password_login], outputs=[is_logged_in, message_output])
|
| 198 |
logout_btn.click(fn=handle_logout, inputs=[], outputs=[is_logged_in, email_login, password_login])
|
| 199 |
-
is_logged_in.change(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 200 |
signup_btn.click(fn=handle_signup, inputs=[name_signup, phone_signup, email_signup, gender_signup, password_signup],
|
| 201 |
outputs=[message_output, name_signup, phone_signup, email_signup, gender_signup, password_signup, signup_accordion])
|
| 202 |
predict_btn.click(fn=predict_image, inputs=image_input, outputs=result)
|
| 203 |
|
|
|
|
|
|
|
| 204 |
if __name__ == "__main__":
|
| 205 |
demo.launch()
|
|
|
|
| 105 |
with gr.Blocks(theme=gr.themes.Soft(), title="VerifiAI - Deepfake Detector") as demo:
|
| 106 |
is_logged_in = gr.State(False)
|
| 107 |
|
| 108 |
+
with gr.Tabs() as tabs:
|
| 109 |
+
with gr.Tab(HOME_TAB_NAME, visible=True) as home_tab:
|
| 110 |
with gr.Row():
|
| 111 |
with gr.Column():
|
| 112 |
gr.Markdown("""
|
|
|
|
| 118 |
</div>
|
| 119 |
""", elem_id="home-markdown")
|
| 120 |
|
| 121 |
+
with gr.Tab(LOGIN_TAB_NAME, visible=True) as login_tab:
|
| 122 |
with gr.Row():
|
| 123 |
with gr.Column(scale=1):
|
| 124 |
gr.Markdown("## Welcome!", "Login to access the detector, or sign up for a new account.")
|
|
|
|
| 165 |
def update_ui_on_auth_change(logged_in_status):
|
| 166 |
if logged_in_status:
|
| 167 |
return (
|
| 168 |
+
gr.update(visible=False), # login_tab
|
| 169 |
+
gr.update(visible=True), # detect_tab
|
| 170 |
+
gr.update(visible=False), # home_tab
|
| 171 |
gr.update(value="β
Login successful!", visible=True)
|
| 172 |
)
|
| 173 |
else:
|
| 174 |
return (
|
| 175 |
+
gr.update(visible=True), # login_tab
|
| 176 |
+
gr.update(visible=False), # detect_tab
|
| 177 |
+
gr.update(visible=True), # home_tab
|
| 178 |
gr.update(value="", visible=False)
|
| 179 |
)
|
| 180 |
|
|
|
|
| 196 |
|
| 197 |
login_btn.click(fn=handle_login, inputs=[email_login, password_login], outputs=[is_logged_in, message_output])
|
| 198 |
logout_btn.click(fn=handle_logout, inputs=[], outputs=[is_logged_in, email_login, password_login])
|
| 199 |
+
is_logged_in.change(
|
| 200 |
+
fn=update_ui_on_auth_change,
|
| 201 |
+
inputs=is_logged_in,
|
| 202 |
+
outputs=[login_tab, detect_tab, home_tab, message_output]
|
| 203 |
+
)
|
| 204 |
signup_btn.click(fn=handle_signup, inputs=[name_signup, phone_signup, email_signup, gender_signup, password_signup],
|
| 205 |
outputs=[message_output, name_signup, phone_signup, email_signup, gender_signup, password_signup, signup_accordion])
|
| 206 |
predict_btn.click(fn=predict_image, inputs=image_input, outputs=result)
|
| 207 |
|
| 208 |
+
demo.load(lambda: False, None, [is_logged_in])
|
| 209 |
+
|
| 210 |
if __name__ == "__main__":
|
| 211 |
demo.launch()
|