Update excel_chat.py
Browse files- excel_chat.py +3 -3
excel_chat.py
CHANGED
@@ -85,12 +85,12 @@ def filter_df(df, column_name, keywords):
|
|
85 |
return filtered_df
|
86 |
|
87 |
def chat_with_mistral(source_cols, dest_col, prompt, excel_file, url, search_col, keywords, client, user):
|
88 |
-
new_prompts, new_keywords, new_user = update_json(user, prompt, keywords)
|
89 |
print(f'xlsxfile = {excel_file}')
|
90 |
df = pd.read_excel(excel_file)
|
91 |
df[dest_col] = ""
|
92 |
if excel_file:
|
93 |
-
file_name = excel_file.split('.xlsx')[0] + "
|
94 |
elif url.endswith('Docs/', 'Docs'):
|
95 |
file_name = url.split("/Docs")[0].split("/")[-1] + ".xlsx"
|
96 |
else:
|
@@ -110,7 +110,7 @@ def chat_with_mistral(source_cols, dest_col, prompt, excel_file, url, search_col
|
|
110 |
df.at[index, dest_col] = llm_answer
|
111 |
|
112 |
df.to_excel(file_name, index=False)
|
113 |
-
return file_name, df.head(5), new_prompts, new_keywords, new_user
|
114 |
|
115 |
|
116 |
def get_columns(file,progress=gr.Progress()):
|
|
|
85 |
return filtered_df
|
86 |
|
87 |
def chat_with_mistral(source_cols, dest_col, prompt, excel_file, url, search_col, keywords, client, user):
|
88 |
+
new_prompts, new_keywords, new_user, conf_file_path = update_json(user, prompt, keywords)
|
89 |
print(f'xlsxfile = {excel_file}')
|
90 |
df = pd.read_excel(excel_file)
|
91 |
df[dest_col] = ""
|
92 |
if excel_file:
|
93 |
+
file_name = excel_file.split('.xlsx')[0] + "_with_" + dest_col.replace(' ', '_') + ".xlsx"
|
94 |
elif url.endswith('Docs/', 'Docs'):
|
95 |
file_name = url.split("/Docs")[0].split("/")[-1] + ".xlsx"
|
96 |
else:
|
|
|
110 |
df.at[index, dest_col] = llm_answer
|
111 |
|
112 |
df.to_excel(file_name, index=False)
|
113 |
+
return file_name, df.head(5), new_prompts, new_keywords, new_user, conf_file_path
|
114 |
|
115 |
|
116 |
def get_columns(file,progress=gr.Progress()):
|