Spaces:
Running
Running
Refactor save_evaluation function to include evaluator parameter and update lambda function in evaluation save button
Browse files- app.py +2 -1
- web/evaluation_interface.py +2 -2
app.py
CHANGED
|
@@ -1095,7 +1095,8 @@ with gr.Blocks() as demo:
|
|
| 1095 |
|
| 1096 |
# Save evaluation
|
| 1097 |
save_btn.click(
|
| 1098 |
-
fn=lambda
|
|
|
|
| 1099 |
inputs=[
|
| 1100 |
selected_conversation, question_display, original_answer, improved_answer,
|
| 1101 |
accuracy, completeness, relevance, clarity, legal_correctness, notes
|
|
|
|
| 1095 |
|
| 1096 |
# Save evaluation
|
| 1097 |
save_btn.click(
|
| 1098 |
+
fn=lambda conv_id, q, orig_a, imp_a, acc, comp, rel, clar, legal, notes:
|
| 1099 |
+
save_evaluation(conv_id, q, orig_a, imp_a, acc, comp, rel, clar, legal, notes, evaluator=chat_evaluator),
|
| 1100 |
inputs=[
|
| 1101 |
selected_conversation, question_display, original_answer, improved_answer,
|
| 1102 |
accuracy, completeness, relevance, clarity, legal_correctness, notes
|
web/evaluation_interface.py
CHANGED
|
@@ -130,7 +130,6 @@ def load_qa_pair_for_evaluation(conversation_id: str, evaluator: ChatEvaluator)
|
|
| 130 |
return ("", "", "", 3, 3, 3, 3, 3, "")
|
| 131 |
|
| 132 |
def save_evaluation(
|
| 133 |
-
evaluator: ChatEvaluator,
|
| 134 |
conversation_id: str,
|
| 135 |
question: str,
|
| 136 |
original_answer: str,
|
|
@@ -140,7 +139,8 @@ def save_evaluation(
|
|
| 140 |
relevance: int,
|
| 141 |
clarity: int,
|
| 142 |
legal_correctness: int,
|
| 143 |
-
notes: str
|
|
|
|
| 144 |
) -> str:
|
| 145 |
"""
|
| 146 |
Save evaluation to file and dataset
|
|
|
|
| 130 |
return ("", "", "", 3, 3, 3, 3, 3, "")
|
| 131 |
|
| 132 |
def save_evaluation(
|
|
|
|
| 133 |
conversation_id: str,
|
| 134 |
question: str,
|
| 135 |
original_answer: str,
|
|
|
|
| 139 |
relevance: int,
|
| 140 |
clarity: int,
|
| 141 |
legal_correctness: int,
|
| 142 |
+
notes: str,
|
| 143 |
+
evaluator: ChatEvaluator
|
| 144 |
) -> str:
|
| 145 |
"""
|
| 146 |
Save evaluation to file and dataset
|