mo01018 commited on
Commit
e42e6ee
·
verified ·
1 Parent(s): ef5e0d2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -106,12 +106,12 @@ def log_interaction(user_input, model_name, predictions):
106
  }
107
 
108
  try:
109
- os.makedirs(os.path.dirname(LOG_FILE), exist_ok=True) # Ensure the directory exists
110
  with open(LOG_FILE, "a") as log_file:
111
  log_file.write(json.dumps(log_entry) + "\n")
 
112
  except Exception as e:
113
- print(f"Error writing to log: {e}")
114
- # You could also return a response with the error, or raise an error to stop the process
115
 
116
 
117
  app = Flask(__name__)
 
106
  }
107
 
108
  try:
109
+ os.makedirs(os.path.dirname(LOG_FILE), exist_ok=True)
110
  with open(LOG_FILE, "a") as log_file:
111
  log_file.write(json.dumps(log_entry) + "\n")
112
+ print("[INFO] Logged interaction successfully.")
113
  except Exception as e:
114
+ print(f"[ERROR] Could not write log entry: {e}")
 
115
 
116
 
117
  app = Flask(__name__)