Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1318,8 +1318,6 @@ def bold_high_impact_row(row):
|
|
| 1318 |
return [''] * len(row)
|
| 1319 |
|
| 1320 |
|
| 1321 |
-
|
| 1322 |
-
|
| 1323 |
def variable_outputs(file_inputs):
|
| 1324 |
|
| 1325 |
file_inputs_single = file_inputs
|
|
@@ -1381,38 +1379,47 @@ def variable_outputs(file_inputs):
|
|
| 1381 |
""",
|
| 1382 |
visible=True,
|
| 1383 |
),
|
| 1384 |
-
|
| 1385 |
-
# ✅ Side-by-side Trust & NPS drivers
|
| 1386 |
gr.Image(
|
| 1387 |
value=combine_two_images_horizontally(img_trust, "Trust Drivers", img_nps, "NPS Drivers"),
|
| 1388 |
type="pil",
|
| 1389 |
label="Trust + NPS Drivers",
|
| 1390 |
visible=True,
|
| 1391 |
),
|
|
|
|
| 1392 |
gr.Image(
|
| 1393 |
-
value=
|
| 1394 |
type="pil",
|
| 1395 |
-
|
|
|
|
| 1396 |
),
|
| 1397 |
-
|
| 1398 |
-
|
| 1399 |
gr.Image(
|
| 1400 |
-
value=
|
| 1401 |
type="pil",
|
| 1402 |
-
|
|
|
|
| 1403 |
),
|
| 1404 |
gr.Image(
|
| 1405 |
-
value=
|
| 1406 |
type="pil",
|
| 1407 |
-
|
|
|
|
| 1408 |
),
|
| 1409 |
gr.Image(
|
| 1410 |
-
value=
|
| 1411 |
type="pil",
|
| 1412 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1413 |
),
|
| 1414 |
gr.Textbox(
|
| 1415 |
value=output_text,
|
|
|
|
| 1416 |
visible=False,
|
| 1417 |
),
|
| 1418 |
]
|
|
@@ -1430,14 +1437,11 @@ def variable_outputs(file_inputs):
|
|
| 1430 |
|
| 1431 |
markdown_6 = gr.Markdown(
|
| 1432 |
"<span style='font-size:17px; font-weight:bold;'>The features and messages that improve your NPS and trust most effectively. They key ones are marked in bold.</span>",
|
| 1433 |
-
#+ "<br>In the table, use the little arrow in each column to toggle the most to least effective TrustBuilders® to fill each Trust Bucket®. Your focus is only on the Trust Bucket® with the highest driver impact. "
|
| 1434 |
-
# + "<br> Note: Even if Trust Buckets® for Customers and Prospects overlap, the most effective statements are very different. This provides clear guidance for acquisition versus loyalty activities.",
|
| 1435 |
visible=True,
|
| 1436 |
)
|
| 1437 |
|
| 1438 |
styled_df = df_builder_pivot.style.apply(bold_high_impact_row, axis=1)
|
| 1439 |
|
| 1440 |
-
|
| 1441 |
table_builder_2 = gr.Dataframe(
|
| 1442 |
value=styled_df,
|
| 1443 |
headers=list(df_builder_pivot.columns),
|
|
@@ -1448,8 +1452,6 @@ def variable_outputs(file_inputs):
|
|
| 1448 |
wrap=True,
|
| 1449 |
)
|
| 1450 |
|
| 1451 |
-
|
| 1452 |
-
|
| 1453 |
plots_visible.append(markdown_5)
|
| 1454 |
plots_visible.append(markdown_6)
|
| 1455 |
plots_visible.append(table_builder_2)
|
|
@@ -1458,12 +1460,11 @@ def variable_outputs(file_inputs):
|
|
| 1458 |
plots_visible.append(gr.Markdown("", visible=False))
|
| 1459 |
plots_visible.append(gr.Dataframe(value=None, label="", visible=False))
|
| 1460 |
|
|
|
|
| 1461 |
plots_invisible = [
|
| 1462 |
gr.Markdown("", visible=False),
|
| 1463 |
gr.Markdown("", visible=False),
|
| 1464 |
-
gr.Image(label="Trust
|
| 1465 |
-
gr.Markdown("", visible=False),
|
| 1466 |
-
gr.Markdown("", visible=False),
|
| 1467 |
gr.Image(label="Trust Drivers", visible=False),
|
| 1468 |
gr.Image(label="NPS Drivers", visible=False),
|
| 1469 |
gr.Image(label="Loyalty Drivers", visible=False),
|
|
|
|
| 1318 |
return [''] * len(row)
|
| 1319 |
|
| 1320 |
|
|
|
|
|
|
|
| 1321 |
def variable_outputs(file_inputs):
|
| 1322 |
|
| 1323 |
file_inputs_single = file_inputs
|
|
|
|
| 1379 |
""",
|
| 1380 |
visible=True,
|
| 1381 |
),
|
| 1382 |
+
# Keep the combined image
|
|
|
|
| 1383 |
gr.Image(
|
| 1384 |
value=combine_two_images_horizontally(img_trust, "Trust Drivers", img_nps, "NPS Drivers"),
|
| 1385 |
type="pil",
|
| 1386 |
label="Trust + NPS Drivers",
|
| 1387 |
visible=True,
|
| 1388 |
),
|
| 1389 |
+
# But also provide the individual images
|
| 1390 |
gr.Image(
|
| 1391 |
+
value=img_trust,
|
| 1392 |
type="pil",
|
| 1393 |
+
label="Trust Drivers",
|
| 1394 |
+
visible=False, # Hidden but available
|
| 1395 |
),
|
|
|
|
|
|
|
| 1396 |
gr.Image(
|
| 1397 |
+
value=img_nps,
|
| 1398 |
type="pil",
|
| 1399 |
+
label="NPS Drivers",
|
| 1400 |
+
visible=False, # Hidden but available
|
| 1401 |
),
|
| 1402 |
gr.Image(
|
| 1403 |
+
value=img_loyalty,
|
| 1404 |
type="pil",
|
| 1405 |
+
label="Loyalty Drivers",
|
| 1406 |
+
visible=False, # Hidden but available
|
| 1407 |
),
|
| 1408 |
gr.Image(
|
| 1409 |
+
value=img_consideration,
|
| 1410 |
type="pil",
|
| 1411 |
+
label="Consideration Drivers",
|
| 1412 |
+
visible=False, # Hidden but available
|
| 1413 |
+
),
|
| 1414 |
+
gr.Image(
|
| 1415 |
+
value=img_satisfaction,
|
| 1416 |
+
type="pil",
|
| 1417 |
+
label="Satisfaction Drivers",
|
| 1418 |
+
visible=False, # Hidden but available
|
| 1419 |
),
|
| 1420 |
gr.Textbox(
|
| 1421 |
value=output_text,
|
| 1422 |
+
label="Analysis Summary",
|
| 1423 |
visible=False,
|
| 1424 |
),
|
| 1425 |
]
|
|
|
|
| 1437 |
|
| 1438 |
markdown_6 = gr.Markdown(
|
| 1439 |
"<span style='font-size:17px; font-weight:bold;'>The features and messages that improve your NPS and trust most effectively. They key ones are marked in bold.</span>",
|
|
|
|
|
|
|
| 1440 |
visible=True,
|
| 1441 |
)
|
| 1442 |
|
| 1443 |
styled_df = df_builder_pivot.style.apply(bold_high_impact_row, axis=1)
|
| 1444 |
|
|
|
|
| 1445 |
table_builder_2 = gr.Dataframe(
|
| 1446 |
value=styled_df,
|
| 1447 |
headers=list(df_builder_pivot.columns),
|
|
|
|
| 1452 |
wrap=True,
|
| 1453 |
)
|
| 1454 |
|
|
|
|
|
|
|
| 1455 |
plots_visible.append(markdown_5)
|
| 1456 |
plots_visible.append(markdown_6)
|
| 1457 |
plots_visible.append(table_builder_2)
|
|
|
|
| 1460 |
plots_visible.append(gr.Markdown("", visible=False))
|
| 1461 |
plots_visible.append(gr.Dataframe(value=None, label="", visible=False))
|
| 1462 |
|
| 1463 |
+
# Adjusted to include all expected outputs
|
| 1464 |
plots_invisible = [
|
| 1465 |
gr.Markdown("", visible=False),
|
| 1466 |
gr.Markdown("", visible=False),
|
| 1467 |
+
gr.Image(label="Trust + NPS Drivers", visible=False),
|
|
|
|
|
|
|
| 1468 |
gr.Image(label="Trust Drivers", visible=False),
|
| 1469 |
gr.Image(label="NPS Drivers", visible=False),
|
| 1470 |
gr.Image(label="Loyalty Drivers", visible=False),
|