Spaces:
Sleeping
Sleeping
Update excel_chat.py
Browse files- excel_chat.py +4 -7
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 =
|
| 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):
|
|
@@ -236,20 +236,17 @@ def chat_with_mistral(source_cols, dest_col, prompt, excel_file, url, search_col
|
|
| 236 |
|
| 237 |
try:
|
| 238 |
if cpt == checkpoint:
|
| 239 |
-
|
| 240 |
-
df2.to_excel("checkpointfile.xlsx", index=False)
|
| 241 |
-
|
| 242 |
checkpoint += 1
|
|
|
|
| 243 |
except Exception as e:
|
| 244 |
-
print(e)
|
| 245 |
-
print("no checkpoint")
|
| 246 |
|
| 247 |
cpt += 1
|
| 248 |
# progress((index+1)/len(df),desc=f'Request {index+1}/{len(df)}!')
|
| 249 |
|
| 250 |
df.to_excel(file_name, index=False)
|
| 251 |
|
| 252 |
-
checkpoints_files.append(file_name)
|
| 253 |
print(checkpoints_files)
|
| 254 |
|
| 255 |
zip_file_path = 'config_file.zip'
|
|
|
|
| 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):
|
|
|
|
| 236 |
|
| 237 |
try:
|
| 238 |
if cpt == checkpoint:
|
| 239 |
+
df.to_excel("checkpointfile.xlsx", index=False)
|
|
|
|
|
|
|
| 240 |
checkpoint += 1
|
| 241 |
+
|
| 242 |
except Exception as e:
|
| 243 |
+
print(f"no checkpoint : {e}")
|
|
|
|
| 244 |
|
| 245 |
cpt += 1
|
| 246 |
# progress((index+1)/len(df),desc=f'Request {index+1}/{len(df)}!')
|
| 247 |
|
| 248 |
df.to_excel(file_name, index=False)
|
| 249 |
|
|
|
|
| 250 |
print(checkpoints_files)
|
| 251 |
|
| 252 |
zip_file_path = 'config_file.zip'
|