Spaces:
Build error
Build error
Commit
·
7cd6a5a
1
Parent(s):
5539883
additional error handling for chunking and indeces
Browse files
app.py
CHANGED
|
@@ -31,13 +31,17 @@ def ask_llm_chunk(chunk, questions):
|
|
| 31 |
st.write(f"Type of coordinates[0]: {type(coordinates[0])}") # Debugging line
|
| 32 |
st.write(f"Value of coordinates[0]: {coordinates[0]}") # Debugging line
|
| 33 |
|
|
|
|
|
|
|
| 34 |
if len(coordinates) == 1:
|
| 35 |
row, col = coordinates[0]
|
|
|
|
| 36 |
answers.append(chunk.iloc[row, col])
|
| 37 |
else:
|
| 38 |
cell_values = []
|
| 39 |
for coordinate in coordinates:
|
| 40 |
row, col = coordinate
|
|
|
|
| 41 |
cell_values.append(chunk.iloc[row, col])
|
| 42 |
answers.append(", ".join(map(str, cell_values)))
|
| 43 |
return answers
|
|
@@ -48,6 +52,7 @@ def ask_llm_chunk(chunk, questions):
|
|
| 48 |
|
| 49 |
|
| 50 |
|
|
|
|
| 51 |
MAX_ROWS_PER_CHUNK = 200
|
| 52 |
|
| 53 |
def summarize_map_reduce(data, questions):
|
|
|
|
| 31 |
st.write(f"Type of coordinates[0]: {type(coordinates[0])}") # Debugging line
|
| 32 |
st.write(f"Value of coordinates[0]: {coordinates[0]}") # Debugging line
|
| 33 |
|
| 34 |
+
st.write(f"DataFrame shape: {chunk.shape}") # Debugging line
|
| 35 |
+
|
| 36 |
if len(coordinates) == 1:
|
| 37 |
row, col = coordinates[0]
|
| 38 |
+
st.write(f"Trying to access row {row}, col {col}") # Debugging line
|
| 39 |
answers.append(chunk.iloc[row, col])
|
| 40 |
else:
|
| 41 |
cell_values = []
|
| 42 |
for coordinate in coordinates:
|
| 43 |
row, col = coordinate
|
| 44 |
+
st.write(f"Trying to access row {row}, col {col}") # Debugging line
|
| 45 |
cell_values.append(chunk.iloc[row, col])
|
| 46 |
answers.append(", ".join(map(str, cell_values)))
|
| 47 |
return answers
|
|
|
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
+
|
| 56 |
MAX_ROWS_PER_CHUNK = 200
|
| 57 |
|
| 58 |
def summarize_map_reduce(data, questions):
|