Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -29,10 +29,10 @@ scheduler = CommitScheduler(
|
|
29 |
token=HF_UPLOAD
|
30 |
)
|
31 |
|
32 |
-
def save_json(
|
33 |
with scheduler.lock:
|
34 |
with JSON_DATASET_PATH.open("a") as f:
|
35 |
-
json.dump({"
|
36 |
f.write("\n")
|
37 |
|
38 |
|
@@ -101,8 +101,8 @@ def generate(
|
|
101 |
outputs.append(text)
|
102 |
yield "".join(outputs)
|
103 |
|
104 |
-
|
105 |
-
save_json(
|
106 |
|
107 |
|
108 |
|
|
|
29 |
token=HF_UPLOAD
|
30 |
)
|
31 |
|
32 |
+
def save_json(question: str, answer: str) -> None:
|
33 |
with scheduler.lock:
|
34 |
with JSON_DATASET_PATH.open("a") as f:
|
35 |
+
json.dump({"question": question, "answer": answer, "datetime": datetime.now().isoformat()}, f, ensure_ascii=False)
|
36 |
f.write("\n")
|
37 |
|
38 |
|
|
|
101 |
outputs.append(text)
|
102 |
yield "".join(outputs)
|
103 |
|
104 |
+
|
105 |
+
save_json(message, "".join(outputs))
|
106 |
|
107 |
|
108 |
|