tricktreat commited on
Commit
e72271e
1 Parent(s): f9e538f

fix full queue

Browse files
Files changed (1) hide show
  1. awesome_chat.py +6 -10
awesome_chat.py CHANGED
@@ -36,8 +36,8 @@ if __name__ != "__main__":
36
 
37
  config = yaml.load(open(args.config, "r"), Loader=yaml.FullLoader)
38
 
39
- if not os.path.exists("logs"):
40
- os.mkdir("logs")
41
 
42
  now = datetime.datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
43
 
@@ -202,18 +202,14 @@ def get_id_reason(choose_str):
202
  return id.strip(), reason.strip(), choose
203
 
204
  def record_case(success, **args):
205
- # time format
206
- global now
207
- global LOG_HF_TOKEN
208
- if success:
209
- f = open(f"logs/log_success_{now}.jsonl", "a")
210
- else:
211
- f = open(f"logs/log_fail_{now}.jsonl", "a")
212
  log = args
213
  f.write(json.dumps(log) + "\n")
214
  f.close()
215
  if LOG_HF_TOKEN:
216
- commit_url = repo.push_to_hub(blocking=True)
217
 
218
  def image_to_bytes(img_url):
219
  img_byte = io.BytesIO()
 
36
 
37
  config = yaml.load(open(args.config, "r"), Loader=yaml.FullLoader)
38
 
39
+ # if not os.path.exists("logs"):
40
+ # os.mkdir("logs")
41
 
42
  now = datetime.datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
43
 
 
202
  return id.strip(), reason.strip(), choose
203
 
204
  def record_case(success, **args):
205
+ if not success:
206
+ return
207
+ f = open(f"logs/log_success_{now}.jsonl", "a")
 
 
 
 
208
  log = args
209
  f.write(json.dumps(log) + "\n")
210
  f.close()
211
  if LOG_HF_TOKEN:
212
+ commit_url = repo.push_to_hub(blocking=False)
213
 
214
  def image_to_bytes(img_url):
215
  img_byte = io.BytesIO()