DongfuJiang commited on
Commit
7ef7e89
1 Parent(s): d994c39
Files changed (1) hide show
  1. serve/utils.py +4 -0
serve/utils.py CHANGED
@@ -141,11 +141,15 @@ def get_ip(request: gr.Request):
141
  def get_conv_log_filename():
142
  t = datetime.datetime.now()
143
  name = os.path.join(LOGDIR, f"{t.year}-{t.month:02d}-{t.day:02d}-conv.json")
 
 
144
  return name
145
 
146
  def get_nsfw_conv_log_filename():
147
  t = datetime.datetime.now()
148
  name = os.path.join(LOGDIR, f"nsfw/{t.year}-{t.month:02d}-{t.day:02d}-conv.json")
 
 
149
  return name
150
 
151
  def save_image_file_on_log_server(image_file:str):
 
141
  def get_conv_log_filename():
142
  t = datetime.datetime.now()
143
  name = os.path.join(LOGDIR, f"{t.year}-{t.month:02d}-{t.day:02d}-conv.json")
144
+ if not os.path.exists(os.path.dirname(name)):
145
+ os.makedirs(os.path.dirname(name))
146
  return name
147
 
148
  def get_nsfw_conv_log_filename():
149
  t = datetime.datetime.now()
150
  name = os.path.join(LOGDIR, f"nsfw/{t.year}-{t.month:02d}-{t.day:02d}-conv.json")
151
+ if not os.path.exists(os.path.dirname(name)):
152
+ os.makedirs(os.path.dirname(name))
153
  return name
154
 
155
  def save_image_file_on_log_server(image_file:str):