mo01018 commited on
Commit
3375360
·
verified ·
1 Parent(s): 2d3cdb6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -107,6 +107,7 @@ import logging
107
  #)
108
 
109
  LOG_FILE = "./usage_log.jsonl" # Use temporary file path for Hugging Face Spaces
 
110
 
111
  def log_interaction(user_input, model_name, predictions):
112
  # https://betterstack.com/community/guides/logging/how-to-start-logging-with-python/
@@ -119,7 +120,7 @@ def log_interaction(user_input, model_name, predictions):
119
  }
120
 
121
  try:
122
- # os.makedirs(os.path.dirname(LOG_FILE), exist_ok=True)
123
  # with open(LOG_FILE, "a") as log_file:
124
  # log_file.write(json.dumps(log_entry) + "\n")
125
  logging.info(log_entry)
 
107
  #)
108
 
109
  LOG_FILE = "./usage_log.jsonl" # Use temporary file path for Hugging Face Spaces
110
+ LOG_FILE = os.path.join("logs", "usage_log.jsonl")
111
 
112
  def log_interaction(user_input, model_name, predictions):
113
  # https://betterstack.com/community/guides/logging/how-to-start-logging-with-python/
 
120
  }
121
 
122
  try:
123
+ os.makedirs("logs", exist_ok=True)
124
  # with open(LOG_FILE, "a") as log_file:
125
  # log_file.write(json.dumps(log_entry) + "\n")
126
  logging.info(log_entry)