Spaces:
Build error
Build error
Upload 3 files
Browse files- ProductInfo.csv +0 -0
- app.py +56 -0
- requirements.txt +118 -0
ProductInfo.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
app.py
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import pandas as pd
|
| 3 |
+
import matplotlib.pyplot as plt
|
| 4 |
+
import numpy as np
|
| 5 |
+
|
| 6 |
+
# Load the dataset
|
| 7 |
+
data = pd.read_csv("ProductInfo.csv") # Replace with your actual dataset
|
| 8 |
+
|
| 9 |
+
# Title and description
|
| 10 |
+
st.title("Demand Forecasting")
|
| 11 |
+
st.write("Demand Overview for Top 10 Products")
|
| 12 |
+
|
| 13 |
+
# Sample dropdown for stock codes or product codes
|
| 14 |
+
stock_codes = data['StockCode'].unique()
|
| 15 |
+
selected_stock = st.selectbox("Select a Stock Code:", stock_codes)
|
| 16 |
+
|
| 17 |
+
# Filter data for selected stock code
|
| 18 |
+
filtered_data = data[data['StockCode'] == selected_stock]
|
| 19 |
+
|
| 20 |
+
# Generate dummy data for the forecast and actual values
|
| 21 |
+
# Replace this with your actual forecasting model's output
|
| 22 |
+
dates = pd.date_range(start='2023-01-01', periods=len(filtered_data), freq='W')
|
| 23 |
+
actual_demand = np.random.randint(50, 150, size=len(filtered_data)) # Replace with actual demand data
|
| 24 |
+
predicted_demand_train = actual_demand + np.random.normal(0, 10, size=len(filtered_data)) # Replace with your model's predictions
|
| 25 |
+
predicted_demand_test = actual_demand + np.random.normal(0, 15, size=len(filtered_data)) # Replace with your test predictions
|
| 26 |
+
|
| 27 |
+
# Line chart: Actual vs Predicted Demand
|
| 28 |
+
st.write(f"Demand Overview for {selected_stock}")
|
| 29 |
+
fig, ax = plt.subplots(figsize=(10, 6))
|
| 30 |
+
ax.plot(dates, actual_demand, label='Actual Demand', color='blue', marker='o')
|
| 31 |
+
ax.plot(dates, predicted_demand_train, label='Train Predicted Demand', color='green', linestyle='--', marker='x')
|
| 32 |
+
ax.plot(dates, predicted_demand_test, label='Test Predicted Demand', color='red', linestyle='--', marker='x')
|
| 33 |
+
ax.legend()
|
| 34 |
+
ax.set_xlabel("Date")
|
| 35 |
+
ax.set_ylabel("Demand")
|
| 36 |
+
st.pyplot(fig)
|
| 37 |
+
|
| 38 |
+
# Histograms for error distributions
|
| 39 |
+
train_error = actual_demand - predicted_demand_train
|
| 40 |
+
test_error = actual_demand - predicted_demand_test
|
| 41 |
+
|
| 42 |
+
# Training Error Distribution
|
| 43 |
+
st.write("Training Error Distribution")
|
| 44 |
+
fig, ax = plt.subplots(figsize=(6, 4))
|
| 45 |
+
ax.hist(train_error, bins=20, color='green', alpha=0.7)
|
| 46 |
+
ax.set_xlabel("Error")
|
| 47 |
+
ax.set_ylabel("Frequency")
|
| 48 |
+
st.pyplot(fig)
|
| 49 |
+
|
| 50 |
+
# Testing Error Distribution
|
| 51 |
+
st.write("Testing Error Distribution")
|
| 52 |
+
fig, ax = plt.subplots(figsize=(6, 4))
|
| 53 |
+
ax.hist(test_error, bins=20, color='red', alpha=0.7)
|
| 54 |
+
ax.set_xlabel("Error")
|
| 55 |
+
ax.set_ylabel("Frequency")
|
| 56 |
+
st.pyplot(fig)
|
requirements.txt
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
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| 17 |
+
debugpy==1.8.1
|
| 18 |
+
decorator==5.1.1
|
| 19 |
+
executing==2.0.1
|
| 20 |
+
flatbuffers==24.3.25
|
| 21 |
+
fonttools==4.54.1
|
| 22 |
+
gast==0.6.0
|
| 23 |
+
gitdb==4.0.11
|
| 24 |
+
GitPython==3.1.43
|
| 25 |
+
google-pasta==0.2.0
|
| 26 |
+
greenlet==3.1.1
|
| 27 |
+
grpcio==1.66.2
|
| 28 |
+
h5py==3.12.1
|
| 29 |
+
holidays==0.57
|
| 30 |
+
idna==3.10
|
| 31 |
+
importlib_resources==6.4.5
|
| 32 |
+
ipykernel==6.29.2
|
| 33 |
+
ipython==8.21.0
|
| 34 |
+
jedi==0.19.1
|
| 35 |
+
Jinja2==3.1.4
|
| 36 |
+
joblib==1.4.2
|
| 37 |
+
jsonschema==4.23.0
|
| 38 |
+
jsonschema-specifications==2023.12.1
|
| 39 |
+
jupyter_client==8.6.0
|
| 40 |
+
jupyter_core==5.7.1
|
| 41 |
+
keras==3.6.0
|
| 42 |
+
kiwisolver==1.4.7
|
| 43 |
+
libclang==18.1.1
|
| 44 |
+
Markdown==3.7
|
| 45 |
+
markdown-it-py==3.0.0
|
| 46 |
+
MarkupSafe==2.1.5
|
| 47 |
+
matplotlib==3.9.2
|
| 48 |
+
matplotlib-inline==0.1.6
|
| 49 |
+
mdurl==0.1.2
|
| 50 |
+
ml-dtypes==0.4.1
|
| 51 |
+
namex==0.0.8
|
| 52 |
+
narwhals==1.9.0
|
| 53 |
+
nest-asyncio==1.6.0
|
| 54 |
+
numpy==1.26.4
|
| 55 |
+
opt_einsum==3.4.0
|
| 56 |
+
optree==0.13.0
|
| 57 |
+
packaging==23.2
|
| 58 |
+
pandas==2.2.3
|
| 59 |
+
parso==0.8.3
|
| 60 |
+
patsy==0.5.6
|
| 61 |
+
pillow==10.4.0
|
| 62 |
+
platformdirs==4.2.0
|
| 63 |
+
plotly==5.24.1
|
| 64 |
+
prompt-toolkit==3.0.43
|
| 65 |
+
prophet==1.1.6
|
| 66 |
+
protobuf==4.25.5
|
| 67 |
+
psutil==5.9.8
|
| 68 |
+
pure-eval==0.2.2
|
| 69 |
+
pyarrow==17.0.0
|
| 70 |
+
pydeck==0.9.1
|
| 71 |
+
Pygments==2.17.2
|
| 72 |
+
pyparsing==3.1.4
|
| 73 |
+
python-dateutil==2.9.0.post0
|
| 74 |
+
pytz==2024.2
|
| 75 |
+
pywin32==306
|
| 76 |
+
pyzmq==25.1.2
|
| 77 |
+
referencing==0.35.1
|
| 78 |
+
requests==2.32.3
|
| 79 |
+
rich==13.9.1
|
| 80 |
+
rpds-py==0.20.0
|
| 81 |
+
scikit-learn==1.5.2
|
| 82 |
+
scipy==1.14.1
|
| 83 |
+
seaborn==0.13.2
|
| 84 |
+
setuptools==75.1.0
|
| 85 |
+
six==1.16.0
|
| 86 |
+
smmap==5.0.1
|
| 87 |
+
SQLAlchemy==2.0.35
|
| 88 |
+
stack-data==0.6.3
|
| 89 |
+
stanio==0.5.1
|
| 90 |
+
statsmodels==0.14.4
|
| 91 |
+
streamlit==1.39.0
|
| 92 |
+
tenacity==9.0.0
|
| 93 |
+
tensorboard==2.17.1
|
| 94 |
+
tensorboard-data-server==0.7.2
|
| 95 |
+
tensorflow==2.17.0
|
| 96 |
+
tensorflow-intel==2.17.0
|
| 97 |
+
termcolor==2.4.0
|
| 98 |
+
threadpoolctl==3.5.0
|
| 99 |
+
toml==0.10.2
|
| 100 |
+
tornado==6.4
|
| 101 |
+
tqdm==4.66.5
|
| 102 |
+
traitlets==5.14.1
|
| 103 |
+
typing_extensions==4.12.2
|
| 104 |
+
tzdata==2024.2
|
| 105 |
+
urllib3==2.2.3
|
| 106 |
+
watchdog==5.0.3
|
| 107 |
+
wcwidth==0.2.13
|
| 108 |
+
Werkzeug==3.0.4
|
| 109 |
+
wheel==0.44.0
|
| 110 |
+
wrapt==1.16.0
|
| 111 |
+
xgboost==2.1.1
|
| 112 |
+
=======
|
| 113 |
+
streamlit
|
| 114 |
+
pandas
|
| 115 |
+
numpy
|
| 116 |
+
matplotlib
|
| 117 |
+
# Add any other necessary packages
|
| 118 |
+
>>>>>>> d44e10b2923e9d56ecc218922b09c19d73c02d18
|