Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,11 +12,26 @@ def load_data():
|
|
| 12 |
print(f"Files in Directory: {os.listdir(cwd)}")
|
| 13 |
lead_time_path = os.path.join(os.getcwd(), "final_cleaned_lead_time_data.csv")
|
| 14 |
inventory_path = os.path.join(os.getcwd(), "inventory.csv")
|
|
|
|
| 15 |
lead_time_data = pd.read_csv(lead_time_path)
|
| 16 |
-
inventory_data = pd.read_csv(inventory_path)
|
| 17 |
-
|
|
|
|
| 18 |
|
| 19 |
-
lead_time_data, inventory_data = load_data()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
def calculate_safety_stock(demand_std, lead_time_mean, z_score=1.645):
|
| 21 |
return z_score * demand_std * np.sqrt(lead_time_mean)
|
| 22 |
|
|
@@ -63,5 +78,4 @@ if st.button("Save Results"):
|
|
| 63 |
inventory_data.to_csv("updated_inventory_data.csv", index=False)
|
| 64 |
st.success("Results saved to 'updated_inventory_data.csv'")
|
| 65 |
if __name__ == "__main__":
|
| 66 |
-
|
| 67 |
-
st.write("Streamlit app is running!")
|
|
|
|
| 12 |
print(f"Files in Directory: {os.listdir(cwd)}")
|
| 13 |
lead_time_path = os.path.join(os.getcwd(), "final_cleaned_lead_time_data.csv")
|
| 14 |
inventory_path = os.path.join(os.getcwd(), "inventory.csv")
|
| 15 |
+
optimization_path = os.path.join(os.getcwd(), "inventory_optimization_results.csv")
|
| 16 |
lead_time_data = pd.read_csv(lead_time_path)
|
| 17 |
+
inventory_data = pd.read_csv(inventory_path)
|
| 18 |
+
optimization_data=pd.read_csv(optimization_path)
|
| 19 |
+
return lead_time_data, inventory_data, optimization_data
|
| 20 |
|
| 21 |
+
lead_time_data, inventory_data, optimization_data = load_data()
|
| 22 |
+
st.header("📊 Inventory Optimization Insights")
|
| 23 |
+
st.write("### Optimization Results Dataset")
|
| 24 |
+
st.dataframe(optimization_data)
|
| 25 |
+
st.write("### Key Metrics Summary")
|
| 26 |
+
st.write(optimization_data.describe())
|
| 27 |
+
st.write("### Optimization Trend")
|
| 28 |
+
if 'Optimization_Score' in optimization_data.columns:
|
| 29 |
+
fig, ax = plt.subplots()
|
| 30 |
+
ax.plot(optimization_data.index, optimization_data['Optimization_Score'], marker='o', linestyle='-')
|
| 31 |
+
ax.set_title("Optimization Score Over Time")
|
| 32 |
+
ax.set_xlabel("Iteration")
|
| 33 |
+
ax.set_ylabel("Score")
|
| 34 |
+
st.pyplot(fig)
|
| 35 |
def calculate_safety_stock(demand_std, lead_time_mean, z_score=1.645):
|
| 36 |
return z_score * demand_std * np.sqrt(lead_time_mean)
|
| 37 |
|
|
|
|
| 78 |
inventory_data.to_csv("updated_inventory_data.csv", index=False)
|
| 79 |
st.success("Results saved to 'updated_inventory_data.csv'")
|
| 80 |
if __name__ == "__main__":
|
| 81 |
+
|
|
|