Spaces:
Sleeping
Sleeping
Update excel_chat.py
Browse files- excel_chat.py +5 -4
excel_chat.py
CHANGED
@@ -221,7 +221,7 @@ def chat_with_mistral(source_cols, dest_col, prompt, excel_file, url, search_col
|
|
221 |
|
222 |
checkpoints_files = []
|
223 |
cpt = 1
|
224 |
-
|
225 |
len(fitered_df) // 4
|
226 |
for index, row in filtred_df.iterrows():
|
227 |
concatenated_content = "\n\n".join(f"{column_name}: {str(row[column_name])}" for column_name in source_cols)
|
@@ -236,19 +236,20 @@ def chat_with_mistral(source_cols, dest_col, prompt, excel_file, url, search_col
|
|
236 |
print(f"{cpt}/{len(filtred_df)}\nQUERY:\n{prompt[0]}\nCONTENT:\n{concatenated_content[:200]}...\n\nANSWER:\n{llm_answer}")
|
237 |
df.at[index, dest_col] = llm_answer
|
238 |
|
239 |
-
if cpt ==
|
240 |
df.to_excel(str(cpt))
|
241 |
checkpoints_files.append(str(cpt))
|
242 |
|
243 |
-
|
244 |
|
245 |
|
246 |
cpt += 1
|
247 |
# progress((index+1)/len(df),desc=f'Request {index+1}/{len(df)}')
|
248 |
|
249 |
df.to_excel(file_name, index=False)
|
250 |
-
|
251 |
|
|
|
|
|
252 |
|
253 |
zip_file_path = 'config_file.zip'
|
254 |
|
|
|
221 |
|
222 |
checkpoints_files = []
|
223 |
cpt = 1
|
224 |
+
checkpoint = 50
|
225 |
len(fitered_df) // 4
|
226 |
for index, row in filtred_df.iterrows():
|
227 |
concatenated_content = "\n\n".join(f"{column_name}: {str(row[column_name])}" for column_name in source_cols)
|
|
|
236 |
print(f"{cpt}/{len(filtred_df)}\nQUERY:\n{prompt[0]}\nCONTENT:\n{concatenated_content[:200]}...\n\nANSWER:\n{llm_answer}")
|
237 |
df.at[index, dest_col] = llm_answer
|
238 |
|
239 |
+
if cpt == checkpoint:
|
240 |
df.to_excel(str(cpt))
|
241 |
checkpoints_files.append(str(cpt))
|
242 |
|
243 |
+
checkpoint += 50
|
244 |
|
245 |
|
246 |
cpt += 1
|
247 |
# progress((index+1)/len(df),desc=f'Request {index+1}/{len(df)}')
|
248 |
|
249 |
df.to_excel(file_name, index=False)
|
|
|
250 |
|
251 |
+
checkpoints_files.append(file_name)
|
252 |
+
print(checkpoints_files)
|
253 |
|
254 |
zip_file_path = 'config_file.zip'
|
255 |
|