|
import streamlit as st |
|
from utils.preprocessing import clean_data |
|
from utils.models import predict_umkm |
|
import matplotlib.pyplot as plt |
|
|
|
|
|
st.title("π AI Supply Chain UMKM") |
|
|
|
|
|
uploaded_file = st.file_uploader("Upload CSV", type="csv") |
|
if uploaded_file: |
|
df = clean_data(uploaded_file) |
|
|
|
|
|
fig, ax = plt.subplots() |
|
ax.plot(df['tanggal'], df['demand'], label='Demand', color='blue') |
|
ax.plot(df['tanggal'], df['supply'], label='Supply', color='red') |
|
ax.fill_between(df['tanggal'], df['demand'], df['supply'], |
|
where=(df['supply'] > df['demand']), |
|
color='green', alpha=0.3, label='Surplus') |
|
ax.legend() |
|
st.pyplot(fig) |
|
|
|
|
|
st.subheader("Rekomendasi") |
|
recommendation = predict_umkm(df) |
|
st.success(recommendation) |
|
|
|
|
|
st.subheader("Parameter Keputusan") |
|
st.json({ |
|
"ROI Estimasi": "15%", |
|
"Anomali Terdeteksi": 0, |
|
"Selisih (Supply - Demand)": 20 |
|
}) |