Spaces:
Paused
Paused
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -1171,7 +1171,21 @@ with gr.Blocks(title="UX Analysis Orchestrator") as demo:
|
|
| 1171 |
if not file: return ""
|
| 1172 |
personas = select_or_create_personas("", "", 1, "Example Persona", file)
|
| 1173 |
if personas:
|
| 1174 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1175 |
return "Error loading preview."
|
| 1176 |
|
| 1177 |
example_personas = get_example_personas()
|
|
@@ -1206,13 +1220,17 @@ with gr.Blocks(title="UX Analysis Orchestrator") as demo:
|
|
| 1206 |
|
| 1207 |
with gr.Tab("Presentation Carousel"):
|
| 1208 |
gr.Markdown("### View Presentation Slides")
|
| 1209 |
-
with gr.Row():
|
| 1210 |
sl_repo_select = gr.Dropdown(label="Repository", choices=[REPO_NAME], value=REPO_NAME, interactive=False)
|
| 1211 |
sl_branch_select = gr.Dropdown(label="Branch", choices=get_repo_branches(REPO_NAME))
|
| 1212 |
-
sl_refresh_branches_btn = gr.Button("Refresh Branches")
|
| 1213 |
|
| 1214 |
with gr.Row():
|
| 1215 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1216 |
sl_render_all_btn = gr.Button("Start Carousel", variant="primary")
|
| 1217 |
|
| 1218 |
with gr.Row(visible=False) as carousel_controls:
|
|
@@ -1228,7 +1246,8 @@ with gr.Blocks(title="UX Analysis Orchestrator") as demo:
|
|
| 1228 |
def sl_update_branches(repo_name):
|
| 1229 |
branches = get_repo_branches(repo_name)
|
| 1230 |
latest = branches[0] if branches else "main"
|
| 1231 |
-
|
|
|
|
| 1232 |
|
| 1233 |
def sl_auto_render(repo, branch):
|
| 1234 |
reports = get_reports_in_branch(repo, branch, filter_type="slides")
|
|
@@ -1254,7 +1273,7 @@ with gr.Blocks(title="UX Analysis Orchestrator") as demo:
|
|
| 1254 |
|
| 1255 |
return status_text, reports, html, carousel_visible, idx, counter_text
|
| 1256 |
|
| 1257 |
-
sl_repo_select.change(fn=sl_update_branches, inputs=[sl_repo_select], outputs=[sl_branch_select])
|
| 1258 |
|
| 1259 |
def start_carousel(repo, branch, decks):
|
| 1260 |
if not decks:
|
|
@@ -1272,7 +1291,7 @@ with gr.Blocks(title="UX Analysis Orchestrator") as demo:
|
|
| 1272 |
counter_text = f"Deck {new_idx + 1} of {len(decks)}: {decks[new_idx]}"
|
| 1273 |
return html, new_idx, counter_text
|
| 1274 |
|
| 1275 |
-
sl_refresh_branches_btn.click(fn=sl_update_branches, inputs=[sl_repo_select], outputs=[sl_branch_select])
|
| 1276 |
|
| 1277 |
sl_branch_select.change(
|
| 1278 |
fn=sl_auto_render,
|
|
@@ -1291,10 +1310,14 @@ with gr.Blocks(title="UX Analysis Orchestrator") as demo:
|
|
| 1291 |
|
| 1292 |
with gr.Tab("Report Viewer"):
|
| 1293 |
gr.Markdown("### View UX Reports & Solutions")
|
| 1294 |
-
with gr.Row():
|
| 1295 |
rv_repo_select = gr.Dropdown(label="Repository", choices=[REPO_NAME], value=REPO_NAME, interactive=False)
|
| 1296 |
rv_branch_select = gr.Dropdown(label="Branch", choices=get_repo_branches(REPO_NAME))
|
| 1297 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1298 |
|
| 1299 |
with gr.Row():
|
| 1300 |
rv_report_select = gr.Dropdown(label="Select Report", choices=[], allow_custom_value=True)
|
|
@@ -1326,27 +1349,32 @@ with gr.Blocks(title="UX Analysis Orchestrator") as demo:
|
|
| 1326 |
def rv_update_branches(repo_name):
|
| 1327 |
branches = get_repo_branches(repo_name)
|
| 1328 |
latest = branches[0] if branches else "main"
|
| 1329 |
-
|
|
|
|
| 1330 |
|
| 1331 |
def rv_update_reports(repo_name, branch_name):
|
| 1332 |
reports = get_reports_in_branch(repo_name, branch_name, filter_type="report")
|
| 1333 |
return gr.update(choices=reports, value=reports[0] if reports else None)
|
| 1334 |
|
| 1335 |
-
rv_repo_select.change(fn=rv_update_branches, inputs=[rv_repo_select], outputs=[rv_branch_select])
|
| 1336 |
def rv_load_wrapper(repo, branch, selected, manual):
|
| 1337 |
path = manual if manual else selected
|
| 1338 |
return get_report_content(repo, branch, path)
|
| 1339 |
|
| 1340 |
-
rv_refresh_branches_btn.click(fn=rv_update_branches, inputs=[rv_repo_select], outputs=[rv_branch_select])
|
| 1341 |
rv_branch_select.change(fn=rv_update_reports, inputs=[rv_repo_select, rv_branch_select], outputs=[rv_report_select])
|
| 1342 |
rv_load_report_btn.click(fn=rv_load_wrapper, inputs=[rv_repo_select, rv_branch_select, rv_report_select, rv_manual_path], outputs=[rv_report_viewer])
|
| 1343 |
|
| 1344 |
with gr.Tab("Persona Thought Logs"):
|
| 1345 |
gr.Markdown("### Persona Internal Monologue & Analysis")
|
| 1346 |
-
with gr.Row():
|
| 1347 |
tl_repo_select = gr.Dropdown(label="Repository", choices=[REPO_NAME], value=REPO_NAME, interactive=False)
|
| 1348 |
tl_branch_select = gr.Dropdown(label="Branch", choices=get_repo_branches(REPO_NAME))
|
| 1349 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1350 |
|
| 1351 |
with gr.Row():
|
| 1352 |
tl_log_select = gr.Dropdown(label="Select Thought Log", choices=[])
|
|
@@ -1355,10 +1383,13 @@ with gr.Blocks(title="UX Analysis Orchestrator") as demo:
|
|
| 1355 |
tl_viewer = gr.Markdown(label="Thought Log Content")
|
| 1356 |
|
| 1357 |
def tl_update_logs(repo, branch):
|
| 1358 |
-
|
| 1359 |
-
|
|
|
|
|
|
|
|
|
|
| 1360 |
|
| 1361 |
-
tl_refresh_btn.click(fn=tl_update_logs, inputs=[tl_repo_select, tl_branch_select], outputs=[tl_log_select])
|
| 1362 |
tl_load_btn.click(fn=get_report_content, inputs=[tl_repo_select, tl_branch_select, tl_log_select], outputs=[tl_viewer])
|
| 1363 |
|
| 1364 |
with gr.Tab("Average User Journey Heatmaps"):
|
|
|
|
| 1171 |
if not file: return ""
|
| 1172 |
personas = select_or_create_personas("", "", 1, "Example Persona", file)
|
| 1173 |
if personas:
|
| 1174 |
+
p = personas[0]
|
| 1175 |
+
name = p.get('name', 'Unknown')
|
| 1176 |
+
bio = p.get('minibio', '')
|
| 1177 |
+
|
| 1178 |
+
# Better summary logic
|
| 1179 |
+
summary = f"### Persona: {name}\n"
|
| 1180 |
+
|
| 1181 |
+
if isinstance(p.get('persona'), dict):
|
| 1182 |
+
pd = p['persona']
|
| 1183 |
+
age = pd.get('age', pd.get('persona', {}).get('age', 'N/A'))
|
| 1184 |
+
occ = pd.get('occupation', {}).get('title', pd.get('persona', {}).get('occupation', {}).get('title', 'N/A'))
|
| 1185 |
+
summary += f"**Age**: {age} | **Occupation**: {occ}\n\n"
|
| 1186 |
+
|
| 1187 |
+
summary += f"**Summary**: {bio[:300]}..." if len(bio) > 300 else f"**Summary**: {bio}"
|
| 1188 |
+
return summary
|
| 1189 |
return "Error loading preview."
|
| 1190 |
|
| 1191 |
example_personas = get_example_personas()
|
|
|
|
| 1220 |
|
| 1221 |
with gr.Tab("Presentation Carousel"):
|
| 1222 |
gr.Markdown("### View Presentation Slides")
|
| 1223 |
+
with gr.Row(visible=False):
|
| 1224 |
sl_repo_select = gr.Dropdown(label="Repository", choices=[REPO_NAME], value=REPO_NAME, interactive=False)
|
| 1225 |
sl_branch_select = gr.Dropdown(label="Branch", choices=get_repo_branches(REPO_NAME))
|
|
|
|
| 1226 |
|
| 1227 |
with gr.Row():
|
| 1228 |
+
sl_refresh_branches_btn = gr.Button("Pull latest results")
|
| 1229 |
+
|
| 1230 |
+
sl_terminal_log = gr.Code(label="Connection Log", language="bash", value=f"[SYSTEM] Connected to {REPO_NAME}\n[SYSTEM] Ready to pull results.")
|
| 1231 |
+
|
| 1232 |
+
with gr.Row():
|
| 1233 |
+
sl_status_display = gr.Markdown("Click 'Pull latest results' to discover slides.")
|
| 1234 |
sl_render_all_btn = gr.Button("Start Carousel", variant="primary")
|
| 1235 |
|
| 1236 |
with gr.Row(visible=False) as carousel_controls:
|
|
|
|
| 1246 |
def sl_update_branches(repo_name):
|
| 1247 |
branches = get_repo_branches(repo_name)
|
| 1248 |
latest = branches[0] if branches else "main"
|
| 1249 |
+
log = f"[SYSTEM] Pulled latest branches from {repo_name}\n[SYSTEM] Current branch: {latest}\n[SYSTEM] Found {len(branches)} branches."
|
| 1250 |
+
return gr.update(choices=branches, value=latest), log
|
| 1251 |
|
| 1252 |
def sl_auto_render(repo, branch):
|
| 1253 |
reports = get_reports_in_branch(repo, branch, filter_type="slides")
|
|
|
|
| 1273 |
|
| 1274 |
return status_text, reports, html, carousel_visible, idx, counter_text
|
| 1275 |
|
| 1276 |
+
sl_repo_select.change(fn=sl_update_branches, inputs=[sl_repo_select], outputs=[sl_branch_select, sl_terminal_log])
|
| 1277 |
|
| 1278 |
def start_carousel(repo, branch, decks):
|
| 1279 |
if not decks:
|
|
|
|
| 1291 |
counter_text = f"Deck {new_idx + 1} of {len(decks)}: {decks[new_idx]}"
|
| 1292 |
return html, new_idx, counter_text
|
| 1293 |
|
| 1294 |
+
sl_refresh_branches_btn.click(fn=sl_update_branches, inputs=[sl_repo_select], outputs=[sl_branch_select, sl_terminal_log])
|
| 1295 |
|
| 1296 |
sl_branch_select.change(
|
| 1297 |
fn=sl_auto_render,
|
|
|
|
| 1310 |
|
| 1311 |
with gr.Tab("Report Viewer"):
|
| 1312 |
gr.Markdown("### View UX Reports & Solutions")
|
| 1313 |
+
with gr.Row(visible=False):
|
| 1314 |
rv_repo_select = gr.Dropdown(label="Repository", choices=[REPO_NAME], value=REPO_NAME, interactive=False)
|
| 1315 |
rv_branch_select = gr.Dropdown(label="Branch", choices=get_repo_branches(REPO_NAME))
|
| 1316 |
+
|
| 1317 |
+
with gr.Row():
|
| 1318 |
+
rv_refresh_branches_btn = gr.Button("Pull latest results")
|
| 1319 |
+
|
| 1320 |
+
rv_terminal_log = gr.Code(label="Connection Log", language="bash", value=f"[SYSTEM] Connected to {REPO_NAME}\n[SYSTEM] Ready to pull results.")
|
| 1321 |
|
| 1322 |
with gr.Row():
|
| 1323 |
rv_report_select = gr.Dropdown(label="Select Report", choices=[], allow_custom_value=True)
|
|
|
|
| 1349 |
def rv_update_branches(repo_name):
|
| 1350 |
branches = get_repo_branches(repo_name)
|
| 1351 |
latest = branches[0] if branches else "main"
|
| 1352 |
+
log = f"[SYSTEM] Pulled latest branches from {repo_name}\n[SYSTEM] Current branch: {latest}\n[SYSTEM] Found {len(branches)} branches."
|
| 1353 |
+
return gr.update(choices=branches, value=latest), log
|
| 1354 |
|
| 1355 |
def rv_update_reports(repo_name, branch_name):
|
| 1356 |
reports = get_reports_in_branch(repo_name, branch_name, filter_type="report")
|
| 1357 |
return gr.update(choices=reports, value=reports[0] if reports else None)
|
| 1358 |
|
| 1359 |
+
rv_repo_select.change(fn=rv_update_branches, inputs=[rv_repo_select], outputs=[rv_branch_select, rv_terminal_log])
|
| 1360 |
def rv_load_wrapper(repo, branch, selected, manual):
|
| 1361 |
path = manual if manual else selected
|
| 1362 |
return get_report_content(repo, branch, path)
|
| 1363 |
|
| 1364 |
+
rv_refresh_branches_btn.click(fn=rv_update_branches, inputs=[rv_repo_select], outputs=[rv_branch_select, rv_terminal_log])
|
| 1365 |
rv_branch_select.change(fn=rv_update_reports, inputs=[rv_repo_select, rv_branch_select], outputs=[rv_report_select])
|
| 1366 |
rv_load_report_btn.click(fn=rv_load_wrapper, inputs=[rv_repo_select, rv_branch_select, rv_report_select, rv_manual_path], outputs=[rv_report_viewer])
|
| 1367 |
|
| 1368 |
with gr.Tab("Persona Thought Logs"):
|
| 1369 |
gr.Markdown("### Persona Internal Monologue & Analysis")
|
| 1370 |
+
with gr.Row(visible=False):
|
| 1371 |
tl_repo_select = gr.Dropdown(label="Repository", choices=[REPO_NAME], value=REPO_NAME, interactive=False)
|
| 1372 |
tl_branch_select = gr.Dropdown(label="Branch", choices=get_repo_branches(REPO_NAME))
|
| 1373 |
+
|
| 1374 |
+
with gr.Row():
|
| 1375 |
+
tl_refresh_btn = gr.Button("Pull latest results")
|
| 1376 |
+
|
| 1377 |
+
tl_terminal_log = gr.Code(label="Connection Log", language="bash", value=f"[SYSTEM] Connected to {REPO_NAME}\n[SYSTEM] Ready to pull results.")
|
| 1378 |
|
| 1379 |
with gr.Row():
|
| 1380 |
tl_log_select = gr.Dropdown(label="Select Thought Log", choices=[])
|
|
|
|
| 1383 |
tl_viewer = gr.Markdown(label="Thought Log Content")
|
| 1384 |
|
| 1385 |
def tl_update_logs(repo, branch):
|
| 1386 |
+
branches = get_repo_branches(repo)
|
| 1387 |
+
latest = branches[0] if branches else "main"
|
| 1388 |
+
log = f"[SYSTEM] Pulled latest branches from {repo}\n[SYSTEM] Current branch: {latest}"
|
| 1389 |
+
logs = get_thought_logs_from_repo(repo, latest)
|
| 1390 |
+
return gr.update(choices=logs, value=logs[0] if logs else None), log
|
| 1391 |
|
| 1392 |
+
tl_refresh_btn.click(fn=tl_update_logs, inputs=[tl_repo_select, tl_branch_select], outputs=[tl_log_select, tl_terminal_log])
|
| 1393 |
tl_load_btn.click(fn=get_report_content, inputs=[tl_repo_select, tl_branch_select, tl_log_select], outputs=[tl_viewer])
|
| 1394 |
|
| 1395 |
with gr.Tab("Average User Journey Heatmaps"):
|