Spaces:
Sleeping
Sleeping
update output filename
Browse files
app.py
CHANGED
@@ -188,9 +188,11 @@ def RAG_evaluation(uploaded_file, user_api_key):
|
|
188 |
avg_row["Question"] = "Average"
|
189 |
score_df = pd.concat([score_df, pd.DataFrame([avg_row])], ignore_index=True)
|
190 |
|
191 |
-
|
|
|
|
|
192 |
score_df.to_csv(output_path, index=False, encoding="utf-8-sig")
|
193 |
-
print("
|
194 |
|
195 |
return score_df, output_path
|
196 |
|
@@ -258,7 +260,7 @@ def check_csv_and_run_with_timeout(file, key):
|
|
258 |
# Gradio 介面
|
259 |
with gr.Blocks() as demo:
|
260 |
gr.Markdown("""
|
261 |
-
## 📐 RAG系統評估工具
|
262 |
|
263 |
### 📄 使用說明
|
264 |
請上傳您 RAG 系統產出的結果檔案(需包含欄位:Question、Context、Answer),並填入您的 OpenAI API Key,以進行評估。
|
|
|
188 |
avg_row["Question"] = "Average"
|
189 |
score_df = pd.concat([score_df, pd.DataFrame([avg_row])], ignore_index=True)
|
190 |
|
191 |
+
original_name = os.path.basename(uploaded_file.name)
|
192 |
+
filename = os.path.splitext(original_name)[0]
|
193 |
+
output_path = f"{filename}_result.csv"
|
194 |
score_df.to_csv(output_path, index=False, encoding="utf-8-sig")
|
195 |
+
print("評估結果已儲存:", output_path)
|
196 |
|
197 |
return score_df, output_path
|
198 |
|
|
|
260 |
# Gradio 介面
|
261 |
with gr.Blocks() as demo:
|
262 |
gr.Markdown("""
|
263 |
+
## 📐 RAG系統評估工具 (分流A)
|
264 |
|
265 |
### 📄 使用說明
|
266 |
請上傳您 RAG 系統產出的結果檔案(需包含欄位:Question、Context、Answer),並填入您的 OpenAI API Key,以進行評估。
|