Spaces:
Running
Running
add more output column
Browse files
main.py
CHANGED
@@ -155,7 +155,6 @@ async def predict(file: UploadFile = File(...)):
|
|
155 |
sample_name_sentence_similarities,
|
156 |
)
|
157 |
df_predicted = nameMappingHelper.map_standard_names()
|
158 |
-
|
159 |
# Create output dataframe and save to CSV - Fix SettingWithCopyWarning by creating a copy
|
160 |
columns_to_keep = ["ファイル名", "シート名", "行", "科目", "名称"]
|
161 |
output_df = inputData.dataframe[columns_to_keep].copy()
|
@@ -163,8 +162,10 @@ async def predict(file: UploadFile = File(...)):
|
|
163 |
# Use .loc to avoid SettingWithCopyWarning
|
164 |
output_df.loc[:, COL_STANDARD_SUBJECT] = df_predicted[COL_STANDARD_SUBJECT]
|
165 |
output_df.loc[:, COL_STANDARD_NAME] = df_predicted[COL_STANDARD_NAME]
|
|
|
|
|
166 |
|
167 |
-
# Save with
|
168 |
output_df.to_csv(output_file_path, index=False, encoding="utf_8_sig")
|
169 |
|
170 |
# Return the file as a download with correct content type and headers
|
|
|
155 |
sample_name_sentence_similarities,
|
156 |
)
|
157 |
df_predicted = nameMappingHelper.map_standard_names()
|
|
|
158 |
# Create output dataframe and save to CSV - Fix SettingWithCopyWarning by creating a copy
|
159 |
columns_to_keep = ["ファイル名", "シート名", "行", "科目", "名称"]
|
160 |
output_df = inputData.dataframe[columns_to_keep].copy()
|
|
|
162 |
# Use .loc to avoid SettingWithCopyWarning
|
163 |
output_df.loc[:, COL_STANDARD_SUBJECT] = df_predicted[COL_STANDARD_SUBJECT]
|
164 |
output_df.loc[:, COL_STANDARD_NAME] = df_predicted[COL_STANDARD_NAME]
|
165 |
+
output_df.loc[:, "参考_名称"] = df_predicted["参考_名称"]
|
166 |
+
output_df.loc[:, "出力_名称_類似度"] = df_predicted["出力_名称_類似度"]
|
167 |
|
168 |
+
# Save with utf_8_sig encoding for Japanese Excel compatibility
|
169 |
output_df.to_csv(output_file_path, index=False, encoding="utf_8_sig")
|
170 |
|
171 |
# Return the file as a download with correct content type and headers
|