Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -97,17 +97,22 @@ else:
|
|
97 |
|
98 |
# If cells are returned, we will extract the corresponding values for plotting
|
99 |
if cells:
|
100 |
-
#
|
101 |
-
cell_values = [float(cell
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
|
|
|
|
|
|
106 |
fig, ax = plt.subplots()
|
107 |
ax.bar(column_names, cell_values)
|
108 |
-
ax.set_xlabel('
|
109 |
ax.set_ylabel('Values')
|
110 |
ax.set_title('Bar Plot of TAPAS Answer')
|
|
|
|
|
111 |
st.pyplot(fig)
|
112 |
|
113 |
except Exception as e:
|
|
|
97 |
|
98 |
# If cells are returned, we will extract the corresponding values for plotting
|
99 |
if cells:
|
100 |
+
# Convert cell values from strings to floats for plotting
|
101 |
+
cell_values = [float(cell) for cell in cells if cell.replace('.', '', 1).isdigit()]
|
102 |
+
|
103 |
+
# Plot the data if we have valid numeric values
|
104 |
+
if len(cell_values) > 0:
|
105 |
+
# Assuming that the coordinates or answer provides context on column names
|
106 |
+
# You can adjust the labels or data based on the actual output
|
107 |
+
column_names = [f"Row {i+1}" for i in range(len(cell_values))]
|
108 |
+
|
109 |
fig, ax = plt.subplots()
|
110 |
ax.bar(column_names, cell_values)
|
111 |
+
ax.set_xlabel('Rows')
|
112 |
ax.set_ylabel('Values')
|
113 |
ax.set_title('Bar Plot of TAPAS Answer')
|
114 |
+
|
115 |
+
# Display the plot in the Streamlit app
|
116 |
st.pyplot(fig)
|
117 |
|
118 |
except Exception as e:
|