Spaces:
Build error
Build error
Commit ·
66f9f66
1
Parent(s): 072f6c1
Update app.py
Browse files15 unmodified lines16171819202122234 unmodified lines28293031323334353637383940414243444546474849505152535455565758596061626364656667686915 unmodified linesst.write(f"An error occurred: {e}")return ["Error occurred while tokenizing"] * len(questions)# Debugging linest.write(f"Token shape: {inputs['input_ids'].shape[1]}")outputs = model(**inputs)predicted_answer_coordinates, predicted_aggregation_indices = tokenizer.convert_logits_to_predictions(4 unmodified linesanswers = []for coordinates in predicted_answer_coordinates:if len(coordinates) == 1:row, col = coordinates[0]try:st.write(f"DataFrame shape: {chunk.shape}") # Debugging linest.write(f"DataFrame columns: {chunk.columns}") # Debugging linest.write(f"Trying to access row {row}, col {col}") # Debugging linevalue = chunk.iloc[row, col]st.write(f"Value accessed: {value}") # New debugging lineif isinstance(value, pd.Series):answers.append(value.values)else:answers.append(value.item() if hasattr(value, 'item') else value)except Exception as e:st.write(f"Exception type: {type(e)}") # New debugging linest.write(f"Exception args: {e.args}") # New debugging linest.write(f"An error occurred: {e}") # Existing debugging lineelse:cell_values = []for coordinate in coordinates:row, col = coordinatetry:value = chunk.iloc[row, col]if isinstance(value, pd.Series):cell_values.append(value.values)else:cell_values.append(value.item() if hasattr(value, 'item') else value)except Exception as e:st.write(f"An error occurred: {e}")cell_values.append("Error")answers.append(", ".join(map(str, cell_values)))return answersMAX_ROWS_PER_CHUNK = 200def summarize_map_reduce(data, questions):15 unmodified lines1617181920212223244 unmodified lines2930313233343536373839404142434445464748495051525354555615 unmodified linesst.write(f"An error occurred: {e}")return ["Error occurred while tokenizing"] * len(questions)if inputs["input_ids"].shape[1] > 512:st.warning("Token limit exceeded for chunk")return ["Token limit exceeded for chunk"] * len(questions)outputs = model(**inputs)predicted_answer_coordinates, predicted_aggregation_indices = tokenizer.convert_logits_to_predictions(4 unmodified linesanswers = []for coordinates in predicted_answer_coordinates:for coordinate in coordinates:row, col = coordinatetry:st.write(f"Trying to access row {row}, col {col}") # Debugging linevalue = chunk.iloc[row, col]st.write(f"Value accessed: {value}") # Debugging lineif isinstance(value, pd.Series):answers.append(value.values)else:answers.append(value.item() if hasattr(value, 'item') else value)except Exception as e:st.write(f"An error occurred: {e}")st.write(f"Type of error: {type(e)}")st.write(f"Arguments of error: {e.args}")answers.append(", ".join(map(str, [chunk.iloc[coordinate].values for coordinate in coordinates])))return answersMAX_ROWS_PER_CHUNK = 200def summarize_map_reduce(data, questions):
app.py+11-24