Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -110,7 +110,7 @@ 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/
|
113 |
-
logging.basicConfig(filename=
|
114 |
log_entry = {
|
115 |
"timestamp": datetime.datetime.utcnow().isoformat(),
|
116 |
"model": model_name,
|
@@ -119,7 +119,7 @@ def log_interaction(user_input, model_name, predictions):
|
|
119 |
}
|
120 |
|
121 |
try:
|
122 |
-
|
123 |
# with open(LOG_FILE, "a") as log_file:
|
124 |
# log_file.write(json.dumps(log_entry) + "\n")
|
125 |
logging.info(log_entry)
|
|
|
110 |
|
111 |
def log_interaction(user_input, model_name, predictions):
|
112 |
# https://betterstack.com/community/guides/logging/how-to-start-logging-with-python/
|
113 |
+
logging.basicConfig(filename=LOG_FILE, level=logging.INFO)
|
114 |
log_entry = {
|
115 |
"timestamp": datetime.datetime.utcnow().isoformat(),
|
116 |
"model": model_name,
|
|
|
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)
|