heymenn commited on
Commit
c70ee77
1 Parent(s): 30eb7f0

Update excel_chat.py

Browse files
Files changed (1) hide show
  1. excel_chat.py +4 -4
excel_chat.py CHANGED
@@ -220,7 +220,7 @@ def chat_with_mistral(source_cols, dest_col, prompt, excel_file, url, search_col
220
  filtred_df = filter_df(df, search_col, keywords)
221
 
222
  cpt = 1
223
- checkpoint = 50
224
  for index, row in filtred_df.iterrows():
225
  concatenated_content = "\n\n".join(f"{column_name}: {str(row[column_name])}" for column_name in source_cols)
226
  if not concatenated_content == "\n\n".join(f"{column_name}: nan" for column_name in source_cols):
@@ -235,11 +235,11 @@ def chat_with_mistral(source_cols, dest_col, prompt, excel_file, url, search_col
235
  df.at[index, dest_col] = llm_answer
236
 
237
  try:
238
-
239
  if cpt == checkpoint:
240
- df.to_excel("checkpointfile", index=False)
 
241
 
242
- checkpoint += 50
243
  except Exception:
244
  print("no checkpoint")
245
 
 
220
  filtred_df = filter_df(df, search_col, keywords)
221
 
222
  cpt = 1
223
+ checkpoint = 2
224
  for index, row in filtred_df.iterrows():
225
  concatenated_content = "\n\n".join(f"{column_name}: {str(row[column_name])}" for column_name in source_cols)
226
  if not concatenated_content == "\n\n".join(f"{column_name}: nan" for column_name in source_cols):
 
235
  df.at[index, dest_col] = llm_answer
236
 
237
  try:
 
238
  if cpt == checkpoint:
239
+ df2 = df
240
+ df2.to_excel("checkpointfile", index=False)
241
 
242
+ checkpoint += 1
243
  except Exception:
244
  print("no checkpoint")
245