Spaces:
Sleeping
Sleeping
Update excel_chat.py
Browse files- excel_chat.py +3 -1
excel_chat.py
CHANGED
@@ -101,12 +101,14 @@ def chat_with_mistral(source_cols, dest_col, prompt, excel_file, url, search_col
|
|
101 |
|
102 |
filtred_df = filter_df(df, search_col, keywords)
|
103 |
|
|
|
104 |
for index, row in filtred_df.iterrows():
|
105 |
concatenated_content = "\n\n".join(f"{column_name}: {str(row[column_name])}" for column_name in source_cols)
|
106 |
if not concatenated_content == "\n\n".join(f"{column_name}: nan" for column_name in source_cols):
|
107 |
llm_answer = ask_llm(prompt[0], concatenated_content, client, user)
|
108 |
-
print(f"{
|
109 |
df.at[index, dest_col] = llm_answer
|
|
|
110 |
# progress((index+1)/len(df),desc=f'Request {index+1}/{len(df)}')
|
111 |
|
112 |
df.to_excel(file_name, index=False)
|
|
|
101 |
|
102 |
filtred_df = filter_df(df, search_col, keywords)
|
103 |
|
104 |
+
cpt = 1
|
105 |
for index, row in filtred_df.iterrows():
|
106 |
concatenated_content = "\n\n".join(f"{column_name}: {str(row[column_name])}" for column_name in source_cols)
|
107 |
if not concatenated_content == "\n\n".join(f"{column_name}: nan" for column_name in source_cols):
|
108 |
llm_answer = ask_llm(prompt[0], concatenated_content, client, user)
|
109 |
+
print(f"{cpt}/{len(filtred_df)}\nQUERY:\n{prompt[0]}\nCONTENT:\n{concatenated_content[:200]}...\n\nANSWER:\n{llm_answer}")
|
110 |
df.at[index, dest_col] = llm_answer
|
111 |
+
cpt += 1
|
112 |
# progress((index+1)/len(df),desc=f'Request {index+1}/{len(df)}')
|
113 |
|
114 |
df.to_excel(file_name, index=False)
|