File size: 1,046 Bytes
3ce3453
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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
    })