Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -161,8 +161,6 @@ def main():
|
|
| 161 |
st.session_state.chat_history = None
|
| 162 |
if "vectorstore" not in st.session_state: #Store vectorstore in session state
|
| 163 |
st.session_state.vectorstore = None
|
| 164 |
-
if "dfs" not in st.session_state: # Initialize dfs
|
| 165 |
-
st.session_state.dfs = []
|
| 166 |
|
| 167 |
st.header("Chat with PDFs and Data :books: :bar_chart:")
|
| 168 |
|
|
@@ -229,15 +227,5 @@ def main():
|
|
| 229 |
else:
|
| 230 |
st.session_state.dfs = None
|
| 231 |
|
| 232 |
-
# Example of creating a bar chart with Plotly Express (replace with your actual data)
|
| 233 |
-
if st.session_state.dfs:
|
| 234 |
-
for df_ in st.session_state.dfs: #Iterate over dataframes
|
| 235 |
-
try:
|
| 236 |
-
fig = px.bar(df_, x=df_.columns[0], y=df_.columns[1], title="Example Bar Chart") #Assumes first two columns are x and y
|
| 237 |
-
fig.update_layout(xaxis_tickangle=-45) # Rotate x-axis labels for better readability
|
| 238 |
-
st.plotly_chart(fig)
|
| 239 |
-
except Exception as e:
|
| 240 |
-
st.write(f"Error plotting chart for dataframe: {e}") #Handle exceptions when plotting
|
| 241 |
-
|
| 242 |
if __name__ == "__main__":
|
| 243 |
main()
|
|
|
|
| 161 |
st.session_state.chat_history = None
|
| 162 |
if "vectorstore" not in st.session_state: #Store vectorstore in session state
|
| 163 |
st.session_state.vectorstore = None
|
|
|
|
|
|
|
| 164 |
|
| 165 |
st.header("Chat with PDFs and Data :books: :bar_chart:")
|
| 166 |
|
|
|
|
| 227 |
else:
|
| 228 |
st.session_state.dfs = None
|
| 229 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 230 |
if __name__ == "__main__":
|
| 231 |
main()
|