Spaces:
Build error
Build error
Commit ·
af37abc
1
Parent(s): 3a49d30
Update app.py
Browse files15 unmodified lines16171819202119202122235 unmodified lines293031323334353637383536373940411 unmodified line434445464748496 unmodified lines5657585960616215 unmodified lines st.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) # Debugging line st.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 lines answers = [] for coordinates in predicted_answer_coordinates: if len(coordinates) == 1: # Debugging lines st.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: st.write(f"DataFrame shape: {chunk.shape}") # Debugging line st.write(f"DataFrame columns: {chunk.columns}") # Debugging line st.write(f"Trying to access row {row}, col {col}") # Debugging line value = chunk.iloc[row, col] if isinstance(value, pd.Series): answers.append(value.values)1 unmodified line answers.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 lines 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 answersapp.py+9-6