Update lab/interim.py
Browse files- lab/interim.py +6 -7
lab/interim.py
CHANGED
@@ -55,7 +55,7 @@ def load_dataset_into_session():
|
|
55 |
)
|
56 |
if st.button("Load Hugging Face Dataset"):
|
57 |
try:
|
58 |
-
dataset = load_dataset(dataset_name, split="train", trust_remote_code=True)
|
59 |
if hasattr(dataset, "to_pandas"):
|
60 |
st.session_state.df = dataset.to_pandas()
|
61 |
else:
|
@@ -81,7 +81,7 @@ load_dataset_into_session()
|
|
81 |
|
82 |
if "df" in st.session_state and llm:
|
83 |
df = st.session_state.df
|
84 |
-
st.write("###
|
85 |
st.dataframe(df.head(10))
|
86 |
|
87 |
# Create SmartDataFrame
|
@@ -109,14 +109,14 @@ if "df" in st.session_state and llm:
|
|
109 |
# Save and display the plot
|
110 |
temp_plot_path = os.path.join(temp_dir, "plot.png")
|
111 |
plt.savefig(temp_plot_path)
|
112 |
-
st.image(temp_plot_path, caption="Generated Plot",
|
113 |
|
114 |
except Exception as e:
|
115 |
st.error(f"Error: {e}")
|
116 |
|
117 |
# Instructions
|
118 |
with st.sidebar:
|
119 |
-
st.header("Instructions")
|
120 |
st.markdown(
|
121 |
"1. Select how you want to input the dataset.\n"
|
122 |
"2. Upload, select, or fetch the dataset using the provided options.\n"
|
@@ -127,8 +127,7 @@ with st.sidebar:
|
|
127 |
"4. Enter a query to generate and view graphs based on patent attributes.\n"
|
128 |
)
|
129 |
st.markdown("---")
|
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 |
-
)
|
134 |
-
|
|
|
55 |
)
|
56 |
if st.button("Load Hugging Face Dataset"):
|
57 |
try:
|
58 |
+
dataset = load_dataset(dataset_name, name="all", 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:
|
|
|
81 |
|
82 |
if "df" in st.session_state and llm:
|
83 |
df = st.session_state.df
|
84 |
+
st.write("### Dataset Preview")
|
85 |
st.dataframe(df.head(10))
|
86 |
|
87 |
# Create SmartDataFrame
|
|
|
109 |
# Save and display the plot
|
110 |
temp_plot_path = os.path.join(temp_dir, "plot.png")
|
111 |
plt.savefig(temp_plot_path)
|
112 |
+
st.image(temp_plot_path, caption="Generated Plot", use_container_width=True)
|
113 |
|
114 |
except Exception as e:
|
115 |
st.error(f"Error: {e}")
|
116 |
|
117 |
# Instructions
|
118 |
with st.sidebar:
|
119 |
+
st.header("Instructions:")
|
120 |
st.markdown(
|
121 |
"1. Select how you want to input the dataset.\n"
|
122 |
"2. Upload, select, or fetch the dataset using the provided options.\n"
|
|
|
127 |
"4. Enter a query to generate and view graphs based on patent attributes.\n"
|
128 |
)
|
129 |
st.markdown("---")
|
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 |
+
)
|
|