Spaces:
Build error
Build error
Commit ·
af37abc
1
Parent(s): 3a49d30
Update app.py
Browse files15 unmodified lines1617181920212223245 unmodified lines30313233343536373839401 unmodified line4243444546476 unmodified lines54555657585915 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(5 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]if isinstance(value, pd.Series):answers.append(value.values)1 unmodified lineanswers.append(value.item() if hasattr(value, 'item') else value)except Exception as e:st.write(f"An error occurred: {e}")else:cell_values = []for coordinate in coordinates:6 unmodified linescell_values.append(value.item() if hasattr(value, 'item') else value)except Exception as e:st.write(f"An error occurred: {e}")answers.append(", ".join(map(str, cell_values)))return answers15 unmodified lines16171819202122235 unmodified lines293031323334353637383940411 unmodified line434445464748496 unmodified lines5657585960616215 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(5 unmodified linesanswers = []for coordinates in predicted_answer_coordinates:if len(coordinates) == 1:# Debugging linesst.write(f"DataFrame shape: {chunk.shape}")st.write(f"DataFrame columns: {chunk.columns}")st.write(f"Trying to access row {coordinates[0][0]}, col {coordinates[0][1]}")row, col = coordinates[0]try:value = chunk.iloc[row, col]if isinstance(value, pd.Series):answers.append(value.values)1 unmodified lineanswers.append(value.item() if hasattr(value, 'item') else value)except Exception as e:st.write(f"An error occurred: {e}")answers.append("Error")else:cell_values = []for coordinate in coordinates:6 unmodified linescell_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 answers
app.py+9-6