Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
a9f6fc2
Init branch
khoitq-acl Jul 14, 2024
c15c812
feat: add processing
khoitq-acl Jul 15, 2024
103882d
feat: update visualizaton
khoitq-acl Jul 17, 2024
990cb24
Merge pull request #1 from quangkhoi1228/feature/khoi
quangkhoi1228 Jul 17, 2024
aee56fb
fix: fix preprocess data type
khoitq-acl Jul 17, 2024
5b2f62b
Merge pull request #2 from quangkhoi1228/feature/khoi
quangkhoi1228 Jul 17, 2024
9fb6b0b
Add preprocess pipeline
ninhnq-katalon Jul 18, 2024
e8ca4a2
Update requirement
ninhnq-katalon Jul 18, 2024
5f74c15
Update git ignore
ninhnq-katalon Jul 18, 2024
6186cd8
Add new requirement file for windows
ninhnq1911 Jul 18, 2024
0683aeb
Update pre-process pipeline
ninhnq-katalon Jul 19, 2024
56fe8d8
Add local data + debugger
ninhnq-katalon Jul 19, 2024
ea4e505
Update
khoitq-acl Jul 19, 2024
bc1bd7d
Merge pull request #3 from quangkhoi1228/feature/khoi
quangkhoi1228 Jul 19, 2024
1120ee5
Add selection pipeline
ninhnq-katalon Jul 19, 2024
ebaaccc
Update pre-process and select pipeline
ninhnq-katalon Jul 19, 2024
a078044
Merge pull request #4 from quangkhoi1228/ninh-preprocessing
ninhnq-katalon Jul 19, 2024
8efb5eb
update prompt
khoitq-acl Jul 19, 2024
faca342
Merge pull request #5 from quangkhoi1228/feature/khoi
quangkhoi1228 Jul 19, 2024
9bee505
Update requirement
khoitq-acl Jul 19, 2024
fe07b03
Merge pull request #6 from quangkhoi1228/feature/khoi
quangkhoi1228 Jul 19, 2024
cd0ebce
Add overview docs
ninhnq-katalon Jul 19, 2024
c6f9513
Update local dev
ninhnq-katalon Jul 19, 2024
44fef00
Support null values handle
ninhnq-katalon Jul 19, 2024
8b5f3af
Add code for model classification
PikarryPham Jul 19, 2024
7fd5767
remove key api
PikarryPham Jul 19, 2024
6556e0a
Update local dev
ninhnq-katalon Jul 19, 2024
163bf86
Update preprocessing pipeline
ninhnq-katalon Jul 19, 2024
7d0a3ed
Enable other process pipeline
ninhnq-katalon Jul 19, 2024
5e8cb77
add inference coding
PikarryPham Jul 19, 2024
b081e85
finish code for gia nha classification
PikarryPham Jul 20, 2024
9eae484
Merge pull request #7 from quangkhoi1228/ninh-preprocessing
quangkhoi1228 Jul 20, 2024
acc6ad2
Merge branch 'main' of https://github.com/quangkhoi1228/house-price-a…
ninhnq-katalon Jul 20, 2024
83927d9
Merge branch 'trang-class' of https://github.com/quangkhoi1228/house-…
ninhnq-katalon Jul 20, 2024
e4cc4ed
Get api key from os env
ninhnq-katalon Jul 20, 2024
405a0da
Add code for model classification
PikarryPham Jul 19, 2024
e768fc9
remove key api
PikarryPham Jul 19, 2024
fc2df4e
add inference coding
PikarryPham Jul 19, 2024
facb436
finish code for gia nha classification
PikarryPham Jul 20, 2024
cae704a
Get api key from os env
ninhnq-katalon Jul 20, 2024
1770bb9
Update api key name
ninhnq-katalon Jul 20, 2024
139ac34
Merge branch 'trang-class' of https://github.com/quangkhoi1228/house-…
ninhnq-katalon Jul 20, 2024
876c306
Update key name
ninhnq-katalon Jul 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,10 @@
*.DS_Store
*.ipynb_checkpoints
data/
test.py
test.py
.venv
.history

.env
.vscode
.conda
127,701 changes: 127,701 additions & 0 deletions app/X_train_res.csv

Large diffs are not rendered by default.

114 changes: 46 additions & 68 deletions app/app.py
Original file line number Diff line number Diff line change
@@ -1,109 +1,87 @@
import time
from data_preprocessing import preprocess_pipeline
import streamlit as st
from streamlit_lottie import st_lottie
from src.data_preprocess.pipeline_selector import get_selected_pipeline
from util import load_lottie, stream_data, welcome_message, introduction_message
from prediction_model import prediction_model_pipeline
from cluster_model import cluster_model_pipeline
from regression_model import regression_model_pipeline
from visualization import data_visualization
from src.visualization import data_visualization, preprocessing
from src.util import read_file_from_streamlit

st.set_page_config(page_title="Streamline Analyst", page_icon=":rocket:", layout="wide")

# TITLE SECTION
with st.container():
st.subheader("Hello there 👋")
st.title("Welcome to Streamline Analyst!")
if 'initialized' not in st.session_state:
st.session_state.initialized = True
if st.session_state.initialized:
st.session_state.welcome_message = welcome_message()
st.write(stream_data(st.session_state.welcome_message))
time.sleep(0.5)
st.write("[Github > ](https://github.com/Wilson-ZheLin/Streamline-Analyst)")
st.session_state.initialized = False
else:
st.write(st.session_state.welcome_message)
st.write("[Github > ](https://github.com/Wilson-ZheLin/Streamline-Analyst)")

# INTRO SECTION
with st.container():
st.divider()
if 'lottie' not in st.session_state:
st.session_state.lottie_url1, st.session_state.lottie_url2 = load_lottie()
st.session_state.lottie = True
import os
from dotenv import load_dotenv

left_column_r1, right_column_r1 = st.columns([6, 4])
with left_column_r1:
st.header("What can Streamline Analyst do?")
st.write(introduction_message()[0])
with right_column_r1:
if st.session_state.lottie:
st_lottie(st.session_state.lottie_url1, height=280, key="animation1")
# Load environment variables from .env file
load_dotenv()

left_column_r2, _, right_column_r2 = st.columns([6, 1, 5])
with left_column_r2:
if st.session_state.lottie:
st_lottie(st.session_state.lottie_url2, height=200, key="animation2")
with right_column_r2:
st.header("Simple to Use")
st.write(introduction_message()[1])
st.set_page_config(page_title="Streamline Analyst", page_icon=":rocket:", layout="wide")
API_KEY = os.getenv("OPENAI_KEY")

# MAIN SECTION
with st.container():
st.divider()
st.header("Let's Get Started")
left_column, right_column = st.columns([6, 4])
with left_column:
API_KEY = st.text_input(
"Your API Key won't be stored or shared!",
placeholder="Enter your API key here...",
QUESTION = st.text_input(
"Nhập câu hỏi phân tích của bạn",
placeholder="...",
value="Visualiza giá nhà theo quận dùng heatmap",
)
uploaded_file = st.file_uploader(
"Choose a data file. Your data won't be stored as well!",
accept_multiple_files=False,
type=["csv", "json", "xls", "xlsx"],
)
st.write("👆Your OpenAI API key:")
uploaded_file = st.file_uploader("Choose a data file. Your data won't be stored as well!", accept_multiple_files=False, type=['csv', 'json', 'xls', 'xlsx'])
if uploaded_file:
if uploaded_file.getvalue():
uploaded_file.seek(0)
st.session_state.DF_uploaded = read_file_from_streamlit(uploaded_file)
st.session_state.is_file_empty = False
else:
st.session_state.is_file_empty = True

with right_column:
SELECTED_MODEL = st.selectbox(
'Which OpenAI model do you want to use?',
('GPT-4-Turbo', 'GPT-3.5-Turbo'))

MODE = st.selectbox(
'Select proper data analysis mode',
('Predictive Classification', 'Clustering Model', 'Regression Model', 'Data Visualization'))

st.write(f'Model selected: :green[{SELECTED_MODEL}]')
st.write(f'Data analysis mode: :green[{MODE}]')
with right_column:
SELECTED_MODEL = st.selectbox("Which OpenAI model do you want to use?", ("GPT-4o-mini", "GPT-4o"))

# Proceed Button
is_proceed_enabled = uploaded_file is not None and API_KEY != "" or uploaded_file is not None and MODE == "Data Visualization"
is_proceed_enabled = (
uploaded_file is not None and API_KEY != "" or uploaded_file is not None and MODE == "Data Visualization"
)

# Initialize the 'button_clicked' state
if 'button_clicked' not in st.session_state:
if "button_clicked" not in st.session_state:
st.session_state.button_clicked = False
if st.button('Start Analysis', disabled=(not is_proceed_enabled) or st.session_state.button_clicked, type="primary"):
if st.button(
"Start Analysis", disabled=(not is_proceed_enabled) or st.session_state.button_clicked, type="primary"
):
st.session_state.button_clicked = True
if "is_file_empty" in st.session_state and st.session_state.is_file_empty:
st.caption('Your data file is empty!')
st.caption("Your data file is empty!")

# Start Analysis
if st.session_state.button_clicked:
GPT_MODEL = 4 if SELECTED_MODEL == 'GPT-4-Turbo' else 3.5
GPT_MODEL = 4 if SELECTED_MODEL == "GPT-4-Turbo" else "GPT-4o-mini"
with st.container():
if "DF_uploaded" not in st.session_state:
st.error("File is empty!")
else:
if MODE == 'Predictive Classification':
prediction_model_pipeline(st.session_state.DF_uploaded, API_KEY, GPT_MODEL)
elif MODE == 'Clustering Model':
cluster_model_pipeline(st.session_state.DF_uploaded, API_KEY, GPT_MODEL)
elif MODE == 'Regression Model':
regression_model_pipeline(st.session_state.DF_uploaded, API_KEY, GPT_MODEL)
elif MODE == 'Data Visualization':
data_visualization(st.session_state.DF_uploaded)
# Select pipeline to process
MODE = get_selected_pipeline(st.session_state.DF_uploaded, QUESTION, GPT_MODEL, API_KEY)
st.write(f"Model selected: :green[{SELECTED_MODEL}]")
st.write(f"Data analysis mode: :green[{MODE}]")

# Start preprocessing pipeline
preprocess_pipeline(st.session_state.DF_uploaded, API_KEY, GPT_MODEL, QUESTION)

# Start selected pipeline
if MODE == "Predictive Classification":
prediction_model_pipeline(st.session_state.DF_uploaded, API_KEY, GPT_MODEL, QUESTION)
elif MODE == "Clustering Model":
cluster_model_pipeline(st.session_state.DF_uploaded, API_KEY, GPT_MODEL, QUESTION)
elif MODE == "Regression Model":
regression_model_pipeline(st.session_state.DF_uploaded, API_KEY, GPT_MODEL, QUESTION)
elif MODE == "Data Visualization":
data_visualization(st.session_state.DF_uploaded, API_KEY, GPT_MODEL, QUESTION)
Loading