psyche commited on
Commit
21ddc42
·
verified ·
1 Parent(s): ce51bd8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -29,10 +29,10 @@ scheduler = CommitScheduler(
29
  token=HF_UPLOAD
30
  )
31
 
32
- def save_json(role: str, content: str) -> None:
33
  with scheduler.lock:
34
  with JSON_DATASET_PATH.open("a") as f:
35
- json.dump({"role": role, "content": content, "datetime": datetime.now().isoformat()}, f, ensure_ascii=False)
36
  f.write("\n")
37
 
38
 
@@ -101,8 +101,8 @@ def generate(
101
  outputs.append(text)
102
  yield "".join(outputs)
103
 
104
- save_json("user", message)
105
- save_json("assistant", "".join(outputs))
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