Spaces:
Running
Running
fix: google sheet scores
Browse files
app.py
CHANGED
@@ -1,6 +1,5 @@
|
|
1 |
import os
|
2 |
import sys
|
3 |
-
import json
|
4 |
import requests
|
5 |
import gradio as gr
|
6 |
import pandas as pd
|
@@ -43,7 +42,12 @@ def log_to_google_sheet(question, answer, contexts, scores):
|
|
43 |
"question": question,
|
44 |
"answer": answer,
|
45 |
"contexts": contexts,
|
46 |
-
"
|
|
|
|
|
|
|
|
|
|
|
47 |
}
|
48 |
response = requests.post(url, json=payload)
|
49 |
print("成功寫入 Google Sheet:", response.status_code)
|
@@ -129,7 +133,7 @@ def RAG_evaluation(uploaded_file, user_api_key):
|
|
129 |
question=input_row["Question"],
|
130 |
answer=input_row["Answer"],
|
131 |
contexts=input_row["Context"],
|
132 |
-
scores=
|
133 |
)
|
134 |
|
135 |
except Exception as e:
|
|
|
1 |
import os
|
2 |
import sys
|
|
|
3 |
import requests
|
4 |
import gradio as gr
|
5 |
import pandas as pd
|
|
|
42 |
"question": question,
|
43 |
"answer": answer,
|
44 |
"contexts": contexts,
|
45 |
+
"faithfulness": scores.get("Faithfulness"),
|
46 |
+
"answer_relevancy": scores.get("Answer Relevancy"),
|
47 |
+
"semantic_similarity": scores.get("Semantic Similarity"),
|
48 |
+
"context_precision": scores.get("Context Precision"),
|
49 |
+
"context_recall": scores.get("Context Recall"),
|
50 |
+
"context_entity_recall": scores.get("Context Entity Recall")
|
51 |
}
|
52 |
response = requests.post(url, json=payload)
|
53 |
print("成功寫入 Google Sheet:", response.status_code)
|
|
|
133 |
question=input_row["Question"],
|
134 |
answer=input_row["Answer"],
|
135 |
contexts=input_row["Context"],
|
136 |
+
scores=record
|
137 |
)
|
138 |
|
139 |
except Exception as e:
|