if is_graph_query: # Handle graph-related questions here if 'between' in question.lower() and 'and' in question.lower(): columns = question.split('between')[-1].split('and') columns = [col.strip() for col in columns] if len(columns) == 2 and all(col in df.columns for col in columns): fig = px.scatter(df, x=columns[0], y=columns[1], title=f"Graph between {columns[0]} and {columns[1]}") st.plotly_chart(fig, use_container_width=True) st.success(f"Here is the graph between '{columns[0]}' and '{columns[1]}'.") else: st.warning("Columns not found in the dataset.") elif 'column' in question.lower(): column = question.split('of')[-1].strip() if column in df.columns: fig = px.line(df, x=df.index, y=column, title=f"Graph of column '{column}'") st.plotly_chart(fig, use_container_width=True) st.success(f"Here is the graph of column '{column}'.") else: st.warning(f"Column '{column}' not found in the data.") # **Do not proceed with TAPAS processing for graph queries** st.stop() # This will stop the code from running further