update existing qas.json
Browse files
app.py
CHANGED
@@ -65,8 +65,10 @@ def read_qs():
|
|
65 |
with open(f"{directory}/qas.json", "r", encoding="utf-8") as f:
|
66 |
qas = json.loads(f.read())
|
67 |
print(f"read {len(qas)} query-responses from qas.json")
|
|
|
|
|
68 |
|
69 |
-
existed_qs = collections.Counter([qa["q"] for qa in qas
|
70 |
remained_qs = []
|
71 |
for q in qs:
|
72 |
if existed_qs[q]>0:
|
|
|
65 |
with open(f"{directory}/qas.json", "r", encoding="utf-8") as f:
|
66 |
qas = json.loads(f.read())
|
67 |
print(f"read {len(qas)} query-responses from qas.json")
|
68 |
+
qas = [{"q":qa["q"], "a":qa["a"]} for qa in qas if qa["a"] is not None]
|
69 |
+
print(f"keep {len(qas)} query-responses from qas.json")
|
70 |
|
71 |
+
existed_qs = collections.Counter([qa["q"] for qa in qas])
|
72 |
remained_qs = []
|
73 |
for q in qs:
|
74 |
if existed_qs[q]>0:
|