import gradio as gr import pandas as pd from datetime import datetime # 🧼 Real CGS janitorial products with simulated competitor prices def get_real_cgs_data(): data = { 'product': [ '12oz Microwaveable Container', '16oz Compostable Hot Cup', 'PET Clear Plastic Cup', 'Industrial Can Liner 55Gal' ], 'cgs_price': [31.99, 59.99, 69.99, 34.95], 'competitor_price': [33.50, 62.00, 72.00, 36.00], # Simulated competitor prices 'synthetic_qty': [95, 5, 60, 15], # Simulated inventory levels 'pricing_action': ['Hold', 'Discount', 'Raise Price', 'Hold'] } df = pd.DataFrame(data) df['price_gap'] = df['competitor_price'] - df['cgs_price'] df['urgency_tag'] = df.apply(urgency_tag, axis=1) df['approval_status'] = df.apply(approval_logic, axis=1) df['flag_for_review'] = df.apply(flag_logic, axis=1) df['suggested_action'] = df.apply(suggest_action, axis=1) df['timestamp'] = datetime.now().strftime("%Y-%m-%d %H:%M:%S") return df # 🚦 Urgency tagging def urgency_tag(row): if row['pricing_action'] == 'Raise Price' and row['synthetic_qty'] > 80: return 'πŸš€ Fast-Moving' elif row['pricing_action'] == 'Discount' and row['synthetic_qty'] < 10: return 'πŸ“¦ Overstocked' else: return '⏸️ Normal' # βœ… Approval logic def approval_logic(row): if row['urgency_tag'] in ['πŸš€ Fast-Moving', 'πŸ“¦ Overstocked']: return 'βœ… Auto-Approved' else: return 'πŸ•’ Pending Review' # ⚠️ Flag logic def flag_logic(row): if row['pricing_action'] == 'Discount' and row['synthetic_qty'] > 80: return '⚠️ Discounting Fast-Mover' elif row['pricing_action'] == 'Raise Price' and row['synthetic_qty'] < 10: return '⚠️ Raising Price on Overstock' else: return '' # 🧭 Suggested action def suggest_action(row): if row['flag_for_review']: return 'πŸ” Investigate Strategy' elif row['approval_status'] == 'βœ… Auto-Approved': return 'πŸ“€ Proceed' else: return 'πŸ“ Await Manager Input' # πŸ“Š Dashboard logic def run_dashboard(): return get_real_cgs_data() # 🌐 Gradio layout with colorful HTML header with gr.Blocks() as demo: gr.HTML("""

πŸ’Ž CGS Janitorial Pricing Intelligence

Real-time insights powered by mock competitor logic and CGS product data.

""") gr.Dataframe(value=run_dashboard(), label="Strategic Pricing Dashboard") # πŸš€ Launch the app if __name__ == "__main__": demo.launch()