lewtun HF staff commited on
Commit
62fc386
1 Parent(s): 6a15265

Save JSON with UTF-8

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -36,11 +36,13 @@ if HF_TOKEN:
36
  def save_inputs_and_outputs(now, inputs, outputs, generate_kwargs):
37
  current_hour = now.strftime("%Y-%m-%d_%H")
38
  file_name = f"prompts_{current_hour}.jsonl"
39
-
40
  if repo is not None:
41
  repo.git_pull(rebase=True)
42
- with open(os.path.join("data", file_name), "a") as f:
43
- json.dump({"inputs": inputs, "outputs": outputs, "generate_kwargs": generate_kwargs}, f, ensure_ascii=False)
 
 
44
  f.write("\n")
45
  repo.push_to_hub()
46
 
 
36
  def save_inputs_and_outputs(now, inputs, outputs, generate_kwargs):
37
  current_hour = now.strftime("%Y-%m-%d_%H")
38
  file_name = f"prompts_{current_hour}.jsonl"
39
+
40
  if repo is not None:
41
  repo.git_pull(rebase=True)
42
+ with open(os.path.join("data", file_name), "a", encoding="utf-8") as f:
43
+ json.dump(
44
+ {"inputs": inputs, "outputs": outputs, "generate_kwargs": generate_kwargs}, f, ensure_ascii=False
45
+ )
46
  f.write("\n")
47
  repo.push_to_hub()
48