CoolFace
Apppublic

Venkatakrishnan-Ramesh/OperationalML

sourceHugging Faceopenrailupdated 3y agoView on Hugging Face
0likes
app.py51 linesDownload Raw Back to root
1import streamlit as st2import plotly.express as px3#from pycaret.regression import setup, compare_models, pull, save_model, load_model4import pandas_profiling5from pycaret.classification import *6import pandas as pd7from streamlit_pandas_profiling import st_profile_report8import os9 10if os.path.exists('./dataset.csv'):11    df = pd.read_csv('dataset.csv', index_col=None)12else:13    df = pd.DataFrame() # default dataframe if one has not been provided14 15with st.sidebar:16    st.image("https://www.onepointltd.com/wp-content/uploads/2020/03/inno2.png")17    st.title("OperationalML")18    choice = st.radio("Navigation", ["Upload","Profiling","Modelling", "Download"])19    st.info("This project application helps you build and explore your data.")20 21if choice == "Upload":22    st.title("Upload Your Dataset")23    file = st.file_uploader("Upload Your Dataset")24    if file:25        df = pd.read_csv(file, index_col=None)26        df.to_csv('dataset.csv', index=None)27        st.dataframe(df)28 29if choice == "Profiling":30    st.title("Exploratory Data Analysis")31    profile_df = df.profile_report()32    st_profile_report(profile_df)33 34if choice == "Modelling":35    chosen_target = st.selectbox('Choose the Target Column', df.columns)36    if chosen_target and st.button('Run Modelling'):37        setup(df, target=chosen_target, silent=True)38        setup_df=pull()39        40        best_model = compare_models()41        compare_df = pull()42        save_model(best_model, 'best_model')43        st.dataframe(compare_df)44 45 46if choice == "Download":47    if os.path.exists('best_model.pkl'):48        with open('best_model.pkl', 'rb') as f:49            st.download_button('Download Model', f, file_name="best_model.pkl")50    else:51        st.warning("No model has been saved yet. Please run modelling first.")