Update app.py
Browse files
app.py
CHANGED
|
@@ -15,8 +15,12 @@ from langchain.chains import RetrievalQA
|
|
| 15 |
from Information import show_general_data_statistics, describe_data, info_data
|
| 16 |
from Preprocessing1 import preview_data, data_cleaning, modify_column_names
|
| 17 |
from Preprocessing2 import handle_categorical_values, missing_values, handle_duplicates, handle_outliers
|
| 18 |
-
from RAG import create_doucment, ask_me, load_models_embedding, load_models_llm, create_database
|
| 19 |
from langchain.vectorstores import FAISS
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
|
| 22 |
|
|
@@ -72,12 +76,35 @@ def upload_data():
|
|
| 72 |
except Exception as e:
|
| 73 |
st.error(f"Error loading file: {e}")
|
| 74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
def preview_data():
|
| 76 |
if "data" in st.session_state:
|
| 77 |
st.title("Preview Dataset")
|
| 78 |
st.dataframe(st.session_state["data"])
|
| 79 |
else:
|
| 80 |
st.warning("Please upload a dataset first.")
|
|
|
|
|
|
|
| 81 |
api="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21"
|
| 82 |
def rag_chatbot():
|
| 83 |
st.title("RAG Chatbot")
|
|
@@ -111,16 +138,56 @@ def main():
|
|
| 111 |
st.sidebar.title("Navigation")
|
| 112 |
options = st.sidebar.radio(
|
| 113 |
"Go to",
|
| 114 |
-
[
|
| 115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
)
|
| 117 |
|
| 118 |
if options == "Upload":
|
| 119 |
upload_data()
|
| 120 |
elif options == "Preview":
|
| 121 |
preview_data()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
elif options == "RAG Chatbot":
|
| 123 |
rag_chatbot()
|
| 124 |
|
|
|
|
|
|
|
|
|
|
| 125 |
if __name__ == "__main__":
|
| 126 |
main()
|
|
|
|
| 15 |
from Information import show_general_data_statistics, describe_data, info_data
|
| 16 |
from Preprocessing1 import preview_data, data_cleaning, modify_column_names
|
| 17 |
from Preprocessing2 import handle_categorical_values, missing_values, handle_duplicates, handle_outliers
|
| 18 |
+
# from RAG import create_doucment, ask_me, load_models_embedding, load_models_llm, create_database
|
| 19 |
from langchain.vectorstores import FAISS
|
| 20 |
+
from Information import show_general_data_statistics, describe_data, info_data
|
| 21 |
+
from Preprocessing1 import preview_data, data_cleaning, modify_column_names
|
| 22 |
+
from Preprocessing2 import handle_categorical_values, missing_values, handle_duplicates, handle_outliers
|
| 23 |
+
from Virtualization import visualize_data
|
| 24 |
|
| 25 |
|
| 26 |
|
|
|
|
| 76 |
except Exception as e:
|
| 77 |
st.error(f"Error loading file: {e}")
|
| 78 |
|
| 79 |
+
def download_data():
|
| 80 |
+
"""Downloads the DataFrame as a CSV file."""
|
| 81 |
+
if "data" in st.session_state and not st.session_state["data"].empty:
|
| 82 |
+
csv = st.session_state["data"].to_csv(index=False).encode('utf-8')
|
| 83 |
+
|
| 84 |
+
download_button = st.download_button(
|
| 85 |
+
label="Download Cleaned Dataset",
|
| 86 |
+
data=csv,
|
| 87 |
+
file_name="cleaned_data.csv",
|
| 88 |
+
mime="text/csv"
|
| 89 |
+
)
|
| 90 |
+
|
| 91 |
+
if download_button:
|
| 92 |
+
st.balloons()
|
| 93 |
+
st.success("Dataset is ready for download!")
|
| 94 |
+
|
| 95 |
+
else:
|
| 96 |
+
st.warning(
|
| 97 |
+
"No data available to download. Please modify or upload a dataset first.")
|
| 98 |
+
|
| 99 |
+
|
| 100 |
def preview_data():
|
| 101 |
if "data" in st.session_state:
|
| 102 |
st.title("Preview Dataset")
|
| 103 |
st.dataframe(st.session_state["data"])
|
| 104 |
else:
|
| 105 |
st.warning("Please upload a dataset first.")
|
| 106 |
+
|
| 107 |
+
|
| 108 |
api="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21"
|
| 109 |
def rag_chatbot():
|
| 110 |
st.title("RAG Chatbot")
|
|
|
|
| 138 |
st.sidebar.title("Navigation")
|
| 139 |
options = st.sidebar.radio(
|
| 140 |
"Go to",
|
| 141 |
+
[
|
| 142 |
+
"Upload",
|
| 143 |
+
"Preview",
|
| 144 |
+
"Data Cleaning",
|
| 145 |
+
"Modify Column Names",
|
| 146 |
+
"General Data Statistics",
|
| 147 |
+
"Describe",
|
| 148 |
+
"Info",
|
| 149 |
+
"Handle Categorical",
|
| 150 |
+
"Missing Values",
|
| 151 |
+
"Handle Duplicates",
|
| 152 |
+
"Handle Outliers",
|
| 153 |
+
"Visualize Data",
|
| 154 |
+
"Download",
|
| 155 |
+
"RAG Chatbot"
|
| 156 |
+
],
|
| 157 |
+
key="unique_navigation_key",
|
| 158 |
)
|
| 159 |
|
| 160 |
if options == "Upload":
|
| 161 |
upload_data()
|
| 162 |
elif options == "Preview":
|
| 163 |
preview_data()
|
| 164 |
+
elif options == "Data Cleaning":
|
| 165 |
+
data_cleaning()
|
| 166 |
+
elif options == "Modify Column Names":
|
| 167 |
+
modify_column_names()
|
| 168 |
+
elif options == "General Data Statistics":
|
| 169 |
+
show_general_data_statistics()
|
| 170 |
+
elif options == "Describe":
|
| 171 |
+
describe_data()
|
| 172 |
+
elif options == "Info":
|
| 173 |
+
info_data()
|
| 174 |
+
elif options == "Handle Categorical":
|
| 175 |
+
handle_categorical_values()
|
| 176 |
+
elif options == "Missing Values":
|
| 177 |
+
missing_values()
|
| 178 |
+
elif options == "Handle Duplicates":
|
| 179 |
+
handle_duplicates()
|
| 180 |
+
elif options == "Handle Outliers":
|
| 181 |
+
handle_outliers()
|
| 182 |
+
elif options == "Visualize Data":
|
| 183 |
+
visualize_data()
|
| 184 |
+
elif options == "Download":
|
| 185 |
+
download_data()
|
| 186 |
elif options == "RAG Chatbot":
|
| 187 |
rag_chatbot()
|
| 188 |
|
| 189 |
+
else:
|
| 190 |
+
st.warning("Please upload a dataset first.")
|
| 191 |
+
|
| 192 |
if __name__ == "__main__":
|
| 193 |
main()
|