import streamlit as st from forecast_engine import forecast_consumables st.title("Consumables Forecast Dashboard") lab_id = st.text_input("Lab ID") usage_data = st.text_area("Enter last 60 days usage, comma-separated") days = st.selectbox("Forecast Period", [7, 14, 30]) if st.button("Forecast"): try: usage_series = list(map(int, usage_data.split(","))) if len(usage_series) != 60: st.error("Please enter exactly 60 days of usage data.") else: forecast = forecast_consumables(usage_series, days) # Display the chart st.line_chart(forecast) # Display the daily predicted usage st.write("Predicted 7-Day Usage:", forecast) # Display the total predicted usage st.success(f"Predicted Total Usage (next {days} days): {sum(forecast):.1f}") except ValueError: st.error("Invalid input. Please enter comma-separated integers (e.g., 10,11,12,...).")