Update lab/interim.py
Browse files- lab/interim.py +5 -6
lab/interim.py
CHANGED
@@ -35,7 +35,7 @@ llm = initialize_llm(model_choice)
|
|
35 |
def load_dataset_into_session():
|
36 |
input_option = st.radio(
|
37 |
"Select Dataset Input:",
|
38 |
-
["Use Repo Directory Dataset", "Use Hugging Face Dataset", "Upload CSV File"], index=
|
39 |
)
|
40 |
|
41 |
# Option 1: Load dataset from the repo directory
|
@@ -53,14 +53,13 @@ def load_dataset_into_session():
|
|
53 |
dataset_name = st.text_input(
|
54 |
"Enter Hugging Face Dataset Name:", value="HUPD/hupd"
|
55 |
)
|
56 |
-
if st.button("Load
|
57 |
try:
|
58 |
-
dataset = load_dataset(dataset_name, name="
|
59 |
if hasattr(dataset, "to_pandas"):
|
60 |
st.session_state.df = dataset.to_pandas()
|
61 |
else:
|
62 |
st.session_state.df = pd.DataFrame(dataset)
|
63 |
-
st.session_state.df = validate_and_clean_dataset(st.session_state.df)
|
64 |
st.success(f"Hugging Face Dataset '{dataset_name}' loaded successfully!")
|
65 |
except Exception as e:
|
66 |
st.error(f"Error loading Hugging Face dataset: {e}")
|
@@ -71,7 +70,6 @@ def load_dataset_into_session():
|
|
71 |
if uploaded_file:
|
72 |
try:
|
73 |
st.session_state.df = pd.read_csv(uploaded_file)
|
74 |
-
st.session_state.df = validate_and_clean_dataset(st.session_state.df)
|
75 |
st.success("File uploaded successfully!")
|
76 |
except Exception as e:
|
77 |
st.error(f"Error reading uploaded file: {e}")
|
@@ -130,4 +128,5 @@ with st.sidebar:
|
|
130 |
st.header("References:")
|
131 |
st.markdown(
|
132 |
"1. [Chat With Your CSV File With PandasAI - Prince Krampah](https://medium.com/aimonks/chat-with-your-csv-file-with-pandasai-22232a13c7b7)"
|
133 |
-
)
|
|
|
|
35 |
def load_dataset_into_session():
|
36 |
input_option = st.radio(
|
37 |
"Select Dataset Input:",
|
38 |
+
["Use Repo Directory Dataset", "Use Hugging Face Dataset", "Upload CSV File"], index=1, horizontal=True
|
39 |
)
|
40 |
|
41 |
# Option 1: Load dataset from the repo directory
|
|
|
53 |
dataset_name = st.text_input(
|
54 |
"Enter Hugging Face Dataset Name:", value="HUPD/hupd"
|
55 |
)
|
56 |
+
if st.button("Load Dataset"):
|
57 |
try:
|
58 |
+
dataset = load_dataset(dataset_name, name="sample", split="train", trust_remote_code=True, uniform_split=True)
|
59 |
if hasattr(dataset, "to_pandas"):
|
60 |
st.session_state.df = dataset.to_pandas()
|
61 |
else:
|
62 |
st.session_state.df = pd.DataFrame(dataset)
|
|
|
63 |
st.success(f"Hugging Face Dataset '{dataset_name}' loaded successfully!")
|
64 |
except Exception as e:
|
65 |
st.error(f"Error loading Hugging Face dataset: {e}")
|
|
|
70 |
if uploaded_file:
|
71 |
try:
|
72 |
st.session_state.df = pd.read_csv(uploaded_file)
|
|
|
73 |
st.success("File uploaded successfully!")
|
74 |
except Exception as e:
|
75 |
st.error(f"Error reading uploaded file: {e}")
|
|
|
128 |
st.header("References:")
|
129 |
st.markdown(
|
130 |
"1. [Chat With Your CSV File With PandasAI - Prince Krampah](https://medium.com/aimonks/chat-with-your-csv-file-with-pandasai-22232a13c7b7)"
|
131 |
+
)
|
132 |
+
|