File size: 1,848 Bytes
495da69
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
36
37
38
39
40
41
42
43
44
45
46
import streamlit as st
import pandas as pd 

st.title("Income Inequality Analysis Application")

# Navigation side bar
st.sidebar.title("Navigation")
app_mode = st.sidebar.selectbox("Choose the app mode", ["Home", "EDA", "Prediction"])

if app_mode == "Home":
    st.subheader("Welcome to Income Inequality Analysis App!")
    st.write("""This machine learning project aims to predict individuals' income levels based on demographic and occupational characteristics. By utilizing machine learning, this classification model is expected to assist the government in formulating more targeted and efficient economic policies to reduce existing social disparities.""")

elif app_mode == "EDA":
    st.subheader("Exploratory Data Analysis (EDA)")
    import eda
    eda.run_eda()

elif app_mode == "Prediction":
    st.subheader("Prediction")
    
    # Import the prediction module
    import prediction

    # Get user input from the prediction module
    user_input = prediction.get_user_input()

    # Prediction Button
    if st.button("Prediksi"):
        try:
            # Display user input in table form
            st.subheader("Data Input Pengguna")
            st.table(user_input)  # Display user input as a table

            # Call the run_modelling function from the prediction module
            prediction_result = prediction.run_modelling(user_input)

            st.subheader("Hasil Prediksi")
            if prediction_result[0] == 0:
                st.write("Berdasarkan analisa, individu dengan data tersebut memiliki penghasilan <= 50.000.000 IDR")
            else:
                st.write("Berdasarkan analisa, individu dengan data tersebut memiliki penghasilan > 50.000.000 IDR")

        except Exception as e:
            st.error(f"An error occurred during prediction: {e}")