Spaces:
Sleeping
Sleeping
Update excel_chat.py
Browse files- excel_chat.py +3 -3
excel_chat.py
CHANGED
@@ -72,7 +72,7 @@ def filter_df(df, column_name, keywords):
|
|
72 |
return filtered_df
|
73 |
|
74 |
def chat_with_mistral(source_cols, dest_col, prompt, excel_file, url, search_col, keywords, client, user):
|
75 |
-
|
76 |
print(f'xlsxfile = {excel_file}')
|
77 |
df = pd.read_excel(excel_file)
|
78 |
df[dest_col] = ""
|
@@ -89,8 +89,8 @@ def chat_with_mistral(source_cols, dest_col, prompt, excel_file, url, search_col
|
|
89 |
print('test')
|
90 |
if not concatenated_content == "\n\n".join(f"{column_name}: nan" for column_name in source_cols):
|
91 |
print('c bon')
|
92 |
-
llm_answer = ask_llm(prompt, concatenated_content, client)
|
93 |
-
print(f"QUERY:\n{prompt}\nCONTENT:\n{concatenated_content[:200]}...\n\nANSWER:\n{llm_answer}")
|
94 |
df.at[index, dest_col] = llm_answer
|
95 |
|
96 |
df.to_excel(file_name, index=False)
|
|
|
72 |
return filtered_df
|
73 |
|
74 |
def chat_with_mistral(source_cols, dest_col, prompt, excel_file, url, search_col, keywords, client, user):
|
75 |
+
update_json(user, prompt, keywords)
|
76 |
print(f'xlsxfile = {excel_file}')
|
77 |
df = pd.read_excel(excel_file)
|
78 |
df[dest_col] = ""
|
|
|
89 |
print('test')
|
90 |
if not concatenated_content == "\n\n".join(f"{column_name}: nan" for column_name in source_cols):
|
91 |
print('c bon')
|
92 |
+
llm_answer = ask_llm(prompt[0], concatenated_content, client)
|
93 |
+
print(f"QUERY:\n{prompt[0]}\nCONTENT:\n{concatenated_content[:200]}...\n\nANSWER:\n{llm_answer}")
|
94 |
df.at[index, dest_col] = llm_answer
|
95 |
|
96 |
df.to_excel(file_name, index=False)
|