Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| from logic import run_delivery_process | |
| import os | |
| # Page Config | |
| st.set_page_config(page_title="Last-Mile AI", page_icon="📦") | |
| st.title("📦 Logistics Exception Resolver") | |
| st.markdown("Automated Multi-Agent System for Delivery Exceptions") | |
| # Input Section | |
| shipment_id = st.text_input("Enter Shipment ID (e.g., SHP-101):") | |
| if st.button("Run AI Analysis"): | |
| if not os.getenv("OPENAI_API_KEY"): | |
| st.error("Please set your OpenAI API Key in the Settings/Secrets!") | |
| elif shipment_id: | |
| with st.spinner("Agents are collaborating..."): | |
| # Call our logic | |
| result = run_delivery_process(shipment_id) | |
| # Layout results | |
| st.divider() | |
| col1, col2 = st.columns(2) | |
| with col1: | |
| st.subheader("Decision") | |
| st.info(f"**Action:** {result['resolution']}") | |
| with col2: | |
| st.subheader("Status") | |
| st.write("✅ Exception Identified" if result['is_exception'] == "YES" else "ℹ️ Routine Event") | |
| st.subheader("Reasoning (Internal Audit)") | |
| st.write(result['rationale']) | |
| st.subheader("Customer Notification") | |
| st.success(result['customer_message']) | |
| # Link to LangSmith (Optional) | |
| st.caption("Detailed traces available in LangSmith dashboard.") | |
| else: | |
| st.warning("Please enter a Shipment ID to continue.") | |
| st.sidebar.markdown("---") | |
| st.sidebar.write("Developed for Project 3 Solution") |