Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -94,6 +94,8 @@ else:
|
|
| 94 |
columns = question.split('between')[-1].split('and')
|
| 95 |
columns = [col.strip() for col in columns]
|
| 96 |
if len(columns) == 2 and all(col in df.columns for col in columns):
|
|
|
|
|
|
|
| 97 |
fig = px.scatter(df, x=columns[0], y=columns[1], title=f"Graph between {columns[0]} and {columns[1]}")
|
| 98 |
st.plotly_chart(fig, use_container_width=True)
|
| 99 |
st.success(f"Here is the graph between '{columns[0]}' and '{columns[1]}'.")
|
|
@@ -102,13 +104,16 @@ else:
|
|
| 102 |
elif 'column' in question.lower():
|
| 103 |
column = question.split('of')[-1].strip()
|
| 104 |
if column in df.columns:
|
|
|
|
|
|
|
| 105 |
fig = px.line(df, x=df.index, y=column, title=f"Graph of column '{column}'")
|
| 106 |
st.plotly_chart(fig, use_container_width=True)
|
| 107 |
st.success(f"Here is the graph of column '{column}'.")
|
| 108 |
else:
|
| 109 |
st.warning(f"Column '{column}' not found in the data.")
|
| 110 |
-
|
| 111 |
-
|
|
|
|
| 112 |
|
| 113 |
# Process TAPAS-related questions if it's not a graph query
|
| 114 |
raw_answer = tqa(table=df, query=question, truncation=True)
|
|
|
|
| 94 |
columns = question.split('between')[-1].split('and')
|
| 95 |
columns = [col.strip() for col in columns]
|
| 96 |
if len(columns) == 2 and all(col in df.columns for col in columns):
|
| 97 |
+
# Debugging log
|
| 98 |
+
st.write(f"Generating graph for columns: {columns[0]} and {columns[1]}") # Debug statement
|
| 99 |
fig = px.scatter(df, x=columns[0], y=columns[1], title=f"Graph between {columns[0]} and {columns[1]}")
|
| 100 |
st.plotly_chart(fig, use_container_width=True)
|
| 101 |
st.success(f"Here is the graph between '{columns[0]}' and '{columns[1]}'.")
|
|
|
|
| 104 |
elif 'column' in question.lower():
|
| 105 |
column = question.split('of')[-1].strip()
|
| 106 |
if column in df.columns:
|
| 107 |
+
# Debugging log
|
| 108 |
+
st.write(f"Generating graph for column: {column}") # Debug statement
|
| 109 |
fig = px.line(df, x=df.index, y=column, title=f"Graph of column '{column}'")
|
| 110 |
st.plotly_chart(fig, use_container_width=True)
|
| 111 |
st.success(f"Here is the graph of column '{column}'.")
|
| 112 |
else:
|
| 113 |
st.warning(f"Column '{column}' not found in the data.")
|
| 114 |
+
|
| 115 |
+
# Use `st.stop()` to stop processing further (no need for return)
|
| 116 |
+
st.stop() # Ensure this is placed after rendering the graph
|
| 117 |
|
| 118 |
# Process TAPAS-related questions if it's not a graph query
|
| 119 |
raw_answer = tqa(table=df, query=question, truncation=True)
|