Wajahat698 commited on
Commit
fcf5252
·
verified ·
1 Parent(s): e6d8f56

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -13
app.py CHANGED
@@ -849,6 +849,12 @@ def batch_file_processing(file_paths):
849
  output_text_list,
850
  )
851
 
 
 
 
 
 
 
852
 
853
  def variable_outputs(file_inputs):
854
 
@@ -964,9 +970,11 @@ def variable_outputs(file_inputs):
964
 
965
  if isinstance(df_builder_pivot, pd.DataFrame):
966
  logger.debug(f"df_builder_pivot: {df_builder_pivot}")
967
- df_builder_pivot["Trust Bucket®"] = df_builder_pivot["Trust Bucket®"].apply(
968
- lambda x: f"<span style='background-color:yellow;'>{x}</span>" if "stability" in x.lower() else x
969
- )
 
 
970
 
971
  markdown_5 = gr.Markdown(
972
  "<span style='font-size:20px; font-weight:bold;'> 4) TrustBuilders® </span>",
@@ -980,16 +988,16 @@ def variable_outputs(file_inputs):
980
  + "<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.",
981
  visible=True,
982
  )
983
-
984
- table_builder_2 = gr.Dataframe(
985
- value=df_builder_pivot,
986
- headers=list(df_builder_pivot.columns),
987
- interactive=False,
988
- label=f"{dataset_name}",
989
- visible=True,
990
- height=800,
991
- wrap=True,
992
- )
993
 
994
  plots_visible.append(markdown_5)
995
  plots_visible.append(markdown_6)
 
849
  output_text_list,
850
  )
851
 
852
+ def highlight_stability(s):
853
+ return [
854
+ "background-color: yellow; font-weight: bold;" if "stability" in str(v).lower() else ""
855
+ for v in s
856
+ ]
857
+
858
 
859
  def variable_outputs(file_inputs):
860
 
 
970
 
971
  if isinstance(df_builder_pivot, pd.DataFrame):
972
  logger.debug(f"df_builder_pivot: {df_builder_pivot}")
973
+ styled_df = df_builder_pivot.style.apply(highlight_stability, axis=1)
974
+ styled_html = styled_df.render()
975
+
976
+
977
+
978
 
979
  markdown_5 = gr.Markdown(
980
  "<span style='font-size:20px; font-weight:bold;'> 4) TrustBuilders® </span>",
 
988
  + "<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.",
989
  visible=True,
990
  )
991
+ table_builder_2 = gr.HTML(styled_html)
992
+ # table_builder_2 = gr.Dataframe(
993
+ # value=df_builder_pivot,
994
+ # headers=list(df_builder_pivot.columns),
995
+ # interactive=False,
996
+ # label=f"{dataset_name}",
997
+ # visible=True,
998
+ # height=800,
999
+ # wrap=True,
1000
+ # )
1001
 
1002
  plots_visible.append(markdown_5)
1003
  plots_visible.append(markdown_6)