Spaces:
Running
Running
Update dashboard.py
Browse files- dashboard.py +25 -8
dashboard.py
CHANGED
@@ -97,13 +97,28 @@ def login_user(email, password):
|
|
97 |
with gr.Blocks(theme=gr.themes.Soft(), title="VerifiAI - Deepfake Detector") as demo:
|
98 |
is_logged_in = gr.State(False)
|
99 |
|
|
|
100 |
LOGIN_TAB_NAME = "π Login"
|
101 |
DETECT_TAB_NAME = "π§ͺ Detect Deepfake"
|
102 |
ABOUT_TAB_NAME = "βΉοΈ About"
|
103 |
COMMUNITY_TAB_NAME = "π Community"
|
104 |
GUIDE_TAB_NAME = "π User Guide"
|
105 |
|
106 |
-
with gr.Tabs(selected=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
with gr.Tab(LOGIN_TAB_NAME) as login_tab:
|
108 |
with gr.Row():
|
109 |
with gr.Column(scale=1):
|
@@ -122,6 +137,7 @@ with gr.Blocks(theme=gr.themes.Soft(), title="VerifiAI - Deepfake Detector") as
|
|
122 |
password_signup = gr.Textbox(label="Create Password", type="password")
|
123 |
signup_btn = gr.Button("Sign Up")
|
124 |
|
|
|
125 |
with gr.Tab(DETECT_TAB_NAME, visible=False) as detect_tab:
|
126 |
with gr.Row():
|
127 |
gr.Markdown("## Deepfake Detector")
|
@@ -132,10 +148,12 @@ with gr.Blocks(theme=gr.themes.Soft(), title="VerifiAI - Deepfake Detector") as
|
|
132 |
result = gr.Textbox(label="Prediction Result", interactive=False)
|
133 |
predict_btn = gr.Button("Predict", variant="primary")
|
134 |
|
|
|
135 |
with gr.Tab(ABOUT_TAB_NAME): about.layout()
|
136 |
with gr.Tab(COMMUNITY_TAB_NAME): community.layout()
|
137 |
with gr.Tab(GUIDE_TAB_NAME): user_guide.layout()
|
138 |
|
|
|
139 |
def update_ui_on_auth_change(logged_in_status):
|
140 |
if logged_in_status:
|
141 |
return (
|
@@ -168,6 +186,11 @@ with gr.Blocks(theme=gr.themes.Soft(), title="VerifiAI - Deepfake Detector") as
|
|
168 |
else:
|
169 |
return gr.update(value=msg, visible=True), name, phone, email, gender, password, gr.update(open=True)
|
170 |
|
|
|
|
|
|
|
|
|
|
|
171 |
login_btn.click(fn=handle_login, inputs=[email_login, password_login], outputs=[is_logged_in, message_output])
|
172 |
logout_btn.click(fn=handle_logout, inputs=[], outputs=[is_logged_in, email_login, password_login])
|
173 |
is_logged_in.change(fn=update_ui_on_auth_change, inputs=is_logged_in, outputs=[login_tab, detect_tab, tabs, message_output])
|
@@ -178,13 +201,7 @@ with gr.Blocks(theme=gr.themes.Soft(), title="VerifiAI - Deepfake Detector") as
|
|
178 |
)
|
179 |
predict_btn.click(fn=predict_image, inputs=image_input, outputs=result)
|
180 |
|
181 |
-
|
182 |
-
return gr.update(visible=True), gr.update(visible=False), gr.update(selected=LOGIN_TAB_NAME), gr.update(visible=False)
|
183 |
-
|
184 |
-
# Force login screen on initial load
|
185 |
-
demo.load(fn=force_ui_update, outputs=[login_tab, detect_tab, tabs, message_output])
|
186 |
-
|
187 |
-
|
188 |
|
189 |
if __name__ == "__main__":
|
190 |
demo.launch()
|
|
|
97 |
with gr.Blocks(theme=gr.themes.Soft(), title="VerifiAI - Deepfake Detector") as demo:
|
98 |
is_logged_in = gr.State(False)
|
99 |
|
100 |
+
HOME_TAB_NAME = "π Home"
|
101 |
LOGIN_TAB_NAME = "π Login"
|
102 |
DETECT_TAB_NAME = "π§ͺ Detect Deepfake"
|
103 |
ABOUT_TAB_NAME = "βΉοΈ About"
|
104 |
COMMUNITY_TAB_NAME = "π Community"
|
105 |
GUIDE_TAB_NAME = "π User Guide"
|
106 |
|
107 |
+
with gr.Tabs(selected=HOME_TAB_NAME) as tabs:
|
108 |
+
# --- HOME TAB ---
|
109 |
+
with gr.Tab(HOME_TAB_NAME) as home_tab:
|
110 |
+
with gr.Column():
|
111 |
+
gr.Markdown("""
|
112 |
+
# ποΈβπ¨οΈ Welcome to VerifiAI
|
113 |
+
Your trusted assistant for detecting deepfakes in images using AI.
|
114 |
+
|
115 |
+
π Upload images, analyze authenticity, and learn how deepfakes work.
|
116 |
+
|
117 |
+
π Click the **Login** tab to access the detector.
|
118 |
+
""")
|
119 |
+
go_login_btn = gr.Button("π Go to Login")
|
120 |
+
|
121 |
+
# --- LOGIN TAB ---
|
122 |
with gr.Tab(LOGIN_TAB_NAME) as login_tab:
|
123 |
with gr.Row():
|
124 |
with gr.Column(scale=1):
|
|
|
137 |
password_signup = gr.Textbox(label="Create Password", type="password")
|
138 |
signup_btn = gr.Button("Sign Up")
|
139 |
|
140 |
+
# --- DETECTION TAB ---
|
141 |
with gr.Tab(DETECT_TAB_NAME, visible=False) as detect_tab:
|
142 |
with gr.Row():
|
143 |
gr.Markdown("## Deepfake Detector")
|
|
|
148 |
result = gr.Textbox(label="Prediction Result", interactive=False)
|
149 |
predict_btn = gr.Button("Predict", variant="primary")
|
150 |
|
151 |
+
# --- OTHER TABS ---
|
152 |
with gr.Tab(ABOUT_TAB_NAME): about.layout()
|
153 |
with gr.Tab(COMMUNITY_TAB_NAME): community.layout()
|
154 |
with gr.Tab(GUIDE_TAB_NAME): user_guide.layout()
|
155 |
|
156 |
+
# --- Logic Handlers ---
|
157 |
def update_ui_on_auth_change(logged_in_status):
|
158 |
if logged_in_status:
|
159 |
return (
|
|
|
186 |
else:
|
187 |
return gr.update(value=msg, visible=True), name, phone, email, gender, password, gr.update(open=True)
|
188 |
|
189 |
+
def go_to_login():
|
190 |
+
return gr.update(selected=LOGIN_TAB_NAME)
|
191 |
+
|
192 |
+
# --- Events ---
|
193 |
+
go_login_btn.click(fn=go_to_login, outputs=tabs)
|
194 |
login_btn.click(fn=handle_login, inputs=[email_login, password_login], outputs=[is_logged_in, message_output])
|
195 |
logout_btn.click(fn=handle_logout, inputs=[], outputs=[is_logged_in, email_login, password_login])
|
196 |
is_logged_in.change(fn=update_ui_on_auth_change, inputs=is_logged_in, outputs=[login_tab, detect_tab, tabs, message_output])
|
|
|
201 |
)
|
202 |
predict_btn.click(fn=predict_image, inputs=image_input, outputs=result)
|
203 |
|
204 |
+
demo.load(fn=lambda: False, outputs=is_logged_in)
|
|
|
|
|
|
|
|
|
|
|
|
|
205 |
|
206 |
if __name__ == "__main__":
|
207 |
demo.launch()
|