Spaces:
Build error
Build error
Ronio Jerico Roque commited on
Commit ·
ffcaafd
1
Parent(s): ff45211
Refactor output handling in content analysis to use safe_value for improved error handling and clarity
Browse files398 unmodified lines39940040140240340440540640740840941041141241313 unmodified lines427428429430431432433434435436437438439440441442398 unmodified linesst.write(f"""Content is king in digital marketing. People log into the internet to look for and consume information in different formats: text-based, video, audio, or image. Content is what help businesses establish their expertise in the industry, convert leads into customers, guide their customers through their sales funnel, and build relationships with their customers. \nWe have evaluated the process of content development strategy and existing content assets of {client_name} based on how they serve clients throughout the customer journey. """)pna_data = get_analyst_response("Content - Process and Assets Analyst")if pna_data:st.markdown("##### AWARENESS STAGE")st.write(pna_data.get('awareness_stage', 'N/A'))st.markdown("##### CONSIDERATION STAGE")st.write(pna_data.get('consideration_stage', 'N/A'))st.markdown("##### DECISION STAGE")st.write(pna_data.get('decision_stage', 'N/A'))else:st.markdown("##### AWARENESS STAGE")13 unmodified linesif conversion:st.markdown("##### AWARENESS TO TRAFFIC")st.write(conversion.get('awareness_to_traffic', 'N/A'))st.markdown("##### TRAFFIC TO LEAD CONVERSION")st.write(conversion.get('traffic_to_lead', 'N/A'))st.markdown("##### LEAD TO SALES CONVERSION")st.write(conversion.get('lead_to_sales', 'N/A'))st.markdown("##### CONVERSION TO BRAND LOYALTY")st.write(conversion.get('conversion_to_brand', 'N/A'))else:st.markdown("##### AWARENESS TO TRAFFIC")st.write(None)398 unmodified lines39940040140240340440540640740840941041141241341441541641741841913 unmodified lines433434435436437438439440441442443444445446447448398 unmodified linesst.write(f"""Content is king in digital marketing. People log into the internet to look for and consume information in different formats: text-based, video, audio, or image. Content is what help businesses establish their expertise in the industry, convert leads into customers, guide their customers through their sales funnel, and build relationships with their customers. \nWe have evaluated the process of content development strategy and existing content assets of {client_name} based on how they serve clients throughout the customer journey. """)def safe_value(data: dict, key: str) -> str:try:value = data.get(key)return value if value else "N/A"except Exception:return "N/A"pna_data = get_analyst_response("Content - Process and Assets Analyst")if pna_data:st.markdown("##### AWARENESS STAGE")st.write(safe_value(pna_data, 'awareness_stage'))st.markdown("##### CONSIDERATION STAGE")st.write(safe_value(pna_data, 'consideration_stage'))st.markdown("##### DECISION STAGE")st.write(safe_value(pna_data, 'decision_stage'))else:st.markdown("##### AWARENESS STAGE")13 unmodified linesif conversion:st.markdown("##### AWARENESS TO TRAFFIC")st.write(safe_value(conversion, 'awareness_to_traffic'))st.markdown("##### TRAFFIC TO LEAD CONVERSION")st.write(safe_value(conversion, 'traffic_to_lead'))st.markdown("##### LEAD TO SALES CONVERSION")st.write(safe_value(conversion, 'lead_to_sales'))st.markdown("##### CONVERSION TO BRAND LOYALTY")st.write(safe_value(conversion, 'conversion_to_brand'))else:st.markdown("##### AWARENESS TO TRAFFIC")st.write(None)
pages/output.py+14-8