Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -1232,64 +1232,60 @@ with gr.Column(scale=1, min_width=350):
|
|
| 1232 |
wrap=True,
|
| 1233 |
)
|
| 1234 |
|
| 1235 |
-
|
| 1236 |
-
|
| 1237 |
-
|
| 1238 |
|
| 1239 |
-
|
| 1240 |
-
|
| 1241 |
-
|
| 1242 |
-
|
| 1243 |
-
|
| 1244 |
-
|
| 1245 |
-
|
| 1246 |
-
|
| 1247 |
-
|
| 1248 |
-
|
| 1249 |
-
|
| 1250 |
-
|
| 1251 |
-
)
|
| 1252 |
-
login_btn = gr.Button("Login", variant="primary", scale=1)
|
| 1253 |
-
logout_btn = gr.Button("Logout", variant="secondary", scale=1)
|
| 1254 |
-
|
| 1255 |
-
# Analytics output
|
| 1256 |
-
admin_output = gr.Markdown("π Enter password to view analytics.")
|
| 1257 |
-
|
| 1258 |
-
# Export buttons
|
| 1259 |
-
with gr.Row():
|
| 1260 |
-
export_leads_btn = gr.Button("π₯ Export Leads (CSV)", variant="secondary")
|
| 1261 |
-
export_leads_output = gr.File(label="Download Leads CSV")
|
| 1262 |
-
|
| 1263 |
-
with gr.Row():
|
| 1264 |
-
export_calc_btn = gr.Button("π₯ Export Calculations (CSV)", variant="secondary")
|
| 1265 |
-
export_calc_output = gr.File(label="Download Calculations CSV")
|
| 1266 |
-
|
| 1267 |
-
# Login/Logout events
|
| 1268 |
-
login_btn.click(
|
| 1269 |
-
fn=admin_login,
|
| 1270 |
-
inputs=[admin_password_input],
|
| 1271 |
-
outputs=[admin_output, admin_password_input, logout_btn],
|
| 1272 |
-
)
|
| 1273 |
-
|
| 1274 |
-
logout_btn.click(
|
| 1275 |
-
fn=logout_admin,
|
| 1276 |
-
inputs=[],
|
| 1277 |
-
outputs=[admin_output, admin_password_input, logout_btn],
|
| 1278 |
-
)
|
| 1279 |
-
|
| 1280 |
-
# Export events
|
| 1281 |
-
export_leads_btn.click(
|
| 1282 |
-
fn=export_leads_wrapper,
|
| 1283 |
-
inputs=[],
|
| 1284 |
-
outputs=[export_leads_output],
|
| 1285 |
-
)
|
| 1286 |
-
|
| 1287 |
-
export_calc_btn.click(
|
| 1288 |
-
fn=export_calculations_wrapper,
|
| 1289 |
-
inputs=[],
|
| 1290 |
-
outputs=[export_calc_output],
|
| 1291 |
)
|
| 1292 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1293 |
# ============================================================
|
| 1294 |
# BREED REFERENCE
|
| 1295 |
# ============================================================
|
|
|
|
| 1232 |
wrap=True,
|
| 1233 |
)
|
| 1234 |
|
| 1235 |
+
# ============================================================
|
| 1236 |
+
# ADMIN-ONLY ANALYTICS TAB
|
| 1237 |
+
# ============================================================
|
| 1238 |
|
| 1239 |
+
with gr.TabItem("π Admin"):
|
| 1240 |
+
gr.Markdown("### π Admin Dashboard")
|
| 1241 |
+
|
| 1242 |
+
with gr.Group(elem_classes="admin-login"):
|
| 1243 |
+
gr.Markdown("Enter admin password to view analytics and download data.")
|
| 1244 |
+
|
| 1245 |
+
with gr.Row():
|
| 1246 |
+
admin_password_input = gr.Textbox(
|
| 1247 |
+
label="Admin Password",
|
| 1248 |
+
placeholder="Enter password...",
|
| 1249 |
+
type="password",
|
| 1250 |
+
scale=2,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1251 |
)
|
| 1252 |
+
login_btn = gr.Button("Login", variant="primary", scale=1)
|
| 1253 |
+
logout_btn = gr.Button("Logout", variant="secondary", scale=1)
|
| 1254 |
+
|
| 1255 |
+
admin_output = gr.Markdown("π Enter password to view analytics.")
|
| 1256 |
+
|
| 1257 |
+
with gr.Row():
|
| 1258 |
+
export_leads_btn = gr.Button("π₯ Export Leads (CSV)", variant="secondary")
|
| 1259 |
+
export_leads_output = gr.File(label="Download Leads CSV")
|
| 1260 |
+
|
| 1261 |
+
with gr.Row():
|
| 1262 |
+
export_calc_btn = gr.Button("π₯ Export Calculations (CSV)", variant="secondary")
|
| 1263 |
+
export_calc_output = gr.File(label="Download Calculations CSV")
|
| 1264 |
+
|
| 1265 |
+
# Login/Logout events
|
| 1266 |
+
login_btn.click(
|
| 1267 |
+
fn=admin_login,
|
| 1268 |
+
inputs=[admin_password_input],
|
| 1269 |
+
outputs=[admin_output, admin_password_input, logout_btn],
|
| 1270 |
+
)
|
| 1271 |
+
|
| 1272 |
+
logout_btn.click(
|
| 1273 |
+
fn=logout_admin,
|
| 1274 |
+
inputs=[],
|
| 1275 |
+
outputs=[admin_output, admin_password_input, logout_btn],
|
| 1276 |
+
)
|
| 1277 |
+
|
| 1278 |
+
export_leads_btn.click(
|
| 1279 |
+
fn=export_leads_wrapper,
|
| 1280 |
+
inputs=[],
|
| 1281 |
+
outputs=[export_leads_output],
|
| 1282 |
+
)
|
| 1283 |
+
|
| 1284 |
+
export_calc_btn.click(
|
| 1285 |
+
fn=export_calculations_wrapper,
|
| 1286 |
+
inputs=[],
|
| 1287 |
+
outputs=[export_calc_output],
|
| 1288 |
+
)
|
| 1289 |
# ============================================================
|
| 1290 |
# BREED REFERENCE
|
| 1291 |
# ============================================================
|