Callmebowoo-22's picture
Create app.py
3ce3453 verified
raw
history blame
1.05 kB
import streamlit as st
from utils.preprocessing import clean_data
from utils.models import predict_umkm
import matplotlib.pyplot as plt
# Judul
st.title("πŸš€ AI Supply Chain UMKM")
# Upload data
uploaded_file = st.file_uploader("Upload CSV", type="csv")
if uploaded_file:
df = clean_data(uploaded_file)
# Grafik supply-demand
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)
# Rekomendasi AI
st.subheader("Rekomendasi")
recommendation = predict_umkm(df)
st.success(recommendation)
# Parameter ROI
st.subheader("Parameter Keputusan")
st.json({
"ROI Estimasi": "15%",
"Anomali Terdeteksi": 0,
"Selisih (Supply - Demand)": 20
})