Spaces:
Sleeping
Sleeping
Update app.py
Browse files648 unmodified lines64965065165265365465565620 unmodified lines6776786796786796806816826836846856806816826836846856866876886896906916926936946956966973 unmodified lines701702703701702703704705705706707708709710711712713714715716717718719720721722723724725726727728729730731732733707734735736737248 unmodified lines9869879889629899909919929939949689699709959969979989991000648 unmodified lines "Stability", "Development", "Relationship", "Benefit", "Vision", "Competence", ]
20 unmodified lines df_builder_pivot = pd.DataFrame(builder_consolidated)
# Define the order of the Trust Driver® categories #trust_driver_order = [ # "Stability", # "Development", # "Relationship", # "Benefit", # "Vision", # "Competence", #] trust_driver_order = [ "Stability", "Development", "Relationship", "Benefit", "Vision", "Competence", ] #trust_driver_order = [ # "Stability", # "Development", # "Relationship", # "Competence", #]
# Convert Trust Driver® column to a categorical type with the specified order df_builder_pivot["Trust Driver®"] = pd.Categorical(3 unmodified lines )
# Sort the DataFrame by 'Trust Driver®' and '%' in descending order within each 'Trust Driver®' #df_builder_pivot = df_builder_pivot.sort_values( # by=["Trust Driver®", "%"], ascending=[True, False] #) df_builder_pivot = df_builder_pivot.sort_values( by=["%"], ascending=[False] by=["Trust Driver®", "%"], ascending=[True, False] ) def text_color_trust_driver(trust_driver): colors = { "Stability": "color: #42546C", "Development": "color: #D4B372", "Relationship": "color: #A94E4D", "Benefit": "color: #5C8084", "Vision": "color: #C98F69", "Competence": "color: #7B92A7", } return colors.get(trust_driver, "") # Apply the text color function to the DataFrame styled_df = df_builder_pivot.style.applymap(lambda trust_driver: text_color_trust_driver(trust_driver), subset=["Trust Driver®"]) # Convert the styled DataFrame to HTML for Gradio display styled_html = styled_df.render() # Use Gradio's `gr.HTML` to render the table with colored text gr.Interface( fn=lambda: styled_html, inputs=[], outputs="html" ).launch() #df_builder_pivot = df_builder_pivot.sort_values( # by=["%"], ascending=[False] #) df_builder_pivot = df_builder_pivot.head(4) #df_builder_pivot = df_builder_pivot.head(4)
248 unmodified lines logger.debug(f"df_builder_pivot: {df_builder_pivot}")
markdown_5 = gr.Markdown( "<span style='font-size:20px; font-weight:bold;'>3) Proof Points</span>", "<span style='font-size:20px; font-weight:bold;'>3)TrustBuilders® </span>", visible=True, )
markdown_6 = gr.Markdown( "These are the reasons to trust and recommend. They can be your brand values, features, attributes, programmes and messages. " + "<br>In the first table, use the little arrow in each column to toggle the most to least effective proof points to fill each Trust Bucket®. Your focus is only on the Trust Bucket® with the highest driver impact. " + "<br>In the second table you see the top scoring proof points ordered by Trust Bucket®. " + "<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.", + "<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. " #+ "<br>In the second table you see the top scoring TrustBuilders® ordered by Trust Bucket®. " + "<br>Retain 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.", visible=True, )
app.py+44-17