Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
import pandas as pd
|
3 |
from inference import (
|
@@ -18,6 +20,12 @@ def ask_evo(question, option1, option2, history, user_vote):
|
|
18 |
options = [option1.strip(), option2.strip()]
|
19 |
result = evo_chat_predict(history, question.strip(), options)
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
row = {
|
22 |
"question": question.strip(),
|
23 |
"option1": option1.strip(),
|
@@ -30,11 +38,8 @@ def ask_evo(question, option1, option2, history, user_vote):
|
|
30 |
}
|
31 |
|
32 |
# Log feedback
|
33 |
-
file_exists = os.path.exists(FEEDBACK_LOG)
|
34 |
with open(FEEDBACK_LOG, "a", newline='', encoding="utf-8") as f:
|
35 |
writer = csv.DictWriter(f, fieldnames=row.keys())
|
36 |
-
if not file_exists:
|
37 |
-
writer.writeheader()
|
38 |
writer.writerow(row)
|
39 |
|
40 |
# Prepare outputs
|
|
|
1 |
+
# app.py
|
2 |
+
|
3 |
import gradio as gr
|
4 |
import pandas as pd
|
5 |
from inference import (
|
|
|
20 |
options = [option1.strip(), option2.strip()]
|
21 |
result = evo_chat_predict(history, question.strip(), options)
|
22 |
|
23 |
+
# Create feedback_log.csv with headers if it doesn't exist
|
24 |
+
if not os.path.exists(FEEDBACK_LOG):
|
25 |
+
with open(FEEDBACK_LOG, "w", encoding="utf-8", newline="") as f:
|
26 |
+
writer = csv.writer(f)
|
27 |
+
writer.writerow(["question", "option1", "option2", "evo_answer", "confidence", "reasoning", "context", "vote"])
|
28 |
+
|
29 |
row = {
|
30 |
"question": question.strip(),
|
31 |
"option1": option1.strip(),
|
|
|
38 |
}
|
39 |
|
40 |
# Log feedback
|
|
|
41 |
with open(FEEDBACK_LOG, "a", newline='', encoding="utf-8") as f:
|
42 |
writer = csv.DictWriter(f, fieldnames=row.keys())
|
|
|
|
|
43 |
writer.writerow(row)
|
44 |
|
45 |
# Prepare outputs
|