Upload 3 files
Browse files- Dockerfile +17 -0
- app.py +23 -0
- model.pkl +3 -0
Dockerfile
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use an official Python runtime as a parent image
|
| 2 |
+
FROM python:3.9-slim
|
| 3 |
+
|
| 4 |
+
# Set the working directory in the container
|
| 5 |
+
WORKDIR /app
|
| 6 |
+
|
| 7 |
+
# Copy the current directory contents into the container at /app
|
| 8 |
+
COPY . /app
|
| 9 |
+
|
| 10 |
+
# Install dependencies
|
| 11 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 12 |
+
|
| 13 |
+
# Expose the port Streamlit will run on
|
| 14 |
+
EXPOSE 8501
|
| 15 |
+
|
| 16 |
+
# Command to run the Streamlit app
|
| 17 |
+
CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|
app.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from forecast_engine import forecast_consumables
|
| 3 |
+
|
| 4 |
+
st.title("Consumables Forecast Dashboard")
|
| 5 |
+
lab_id = st.text_input("Lab ID")
|
| 6 |
+
usage_data = st.text_area("Enter last 60 days usage, comma-separated")
|
| 7 |
+
days = st.selectbox("Forecast Period", [7, 14, 30])
|
| 8 |
+
|
| 9 |
+
if st.button("Forecast"):
|
| 10 |
+
try:
|
| 11 |
+
usage_series = list(map(int, usage_data.split(",")))
|
| 12 |
+
if len(usage_series) != 60:
|
| 13 |
+
st.error("Please enter exactly 60 days of usage data.")
|
| 14 |
+
else:
|
| 15 |
+
forecast = forecast_consumables(usage_series, days)
|
| 16 |
+
# Display the chart
|
| 17 |
+
st.line_chart(forecast)
|
| 18 |
+
# Display the daily predicted usage
|
| 19 |
+
st.write("Predicted 7-Day Usage:", forecast)
|
| 20 |
+
# Display the total predicted usage
|
| 21 |
+
st.success(f"Predicted Total Usage (next {days} days): {sum(forecast):.1f}")
|
| 22 |
+
except ValueError:
|
| 23 |
+
st.error("Invalid input. Please enter comma-separated integers (e.g., 10,11,12,...).")
|
model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fa54c42954b9472a16e16e6e45b0d199d40e250937b676aa538779fe7132fbc3
|
| 3 |
+
size 1529
|