19arjun89 commited on
Commit
f4815d7
·
verified ·
1 Parent(s): 287b290

Update usage_logging.py

Browse files
Files changed (1) hide show
  1. usage_logging.py +4 -3
usage_logging.py CHANGED
@@ -64,6 +64,7 @@ import gradio as gr
64
  from huggingface_hub import HfApi, hf_hub_url
65
  import ipaddress
66
  import pycountry
 
67
 
68
  SPACE_URL = "https://huggingface.co/spaces/19arjun89/AI_Recruiting_Agent"
69
  USAGE_DATASET_REPO = "19arjun89/ai_recruiting_agent_usage"
@@ -174,15 +175,15 @@ def append_visit_to_dataset(
174
  event.update({k: v for k, v in extra_fields.items() if v is not None})
175
 
176
  new_content = (existing.rstrip("\n") + "\n" if existing.strip() else "") + json.dumps(event) + "\n"
177
-
178
  try:
179
  api.upload_file(
180
  repo_id=USAGE_DATASET_REPO,
181
  repo_type="dataset",
182
  path_in_repo=USAGE_JSONL_PATH,
183
- path_or_fileobj=new_content.encode("utf-8"),
184
  commit_message="append visit log",
185
- )
186
  except Exception:
187
  pass
188
 
 
64
  from huggingface_hub import HfApi, hf_hub_url
65
  import ipaddress
66
  import pycountry
67
+ from io import BytesIO
68
 
69
  SPACE_URL = "https://huggingface.co/spaces/19arjun89/AI_Recruiting_Agent"
70
  USAGE_DATASET_REPO = "19arjun89/ai_recruiting_agent_usage"
 
175
  event.update({k: v for k, v in extra_fields.items() if v is not None})
176
 
177
  new_content = (existing.rstrip("\n") + "\n" if existing.strip() else "") + json.dumps(event) + "\n"
178
+ print("DEBUG EVENT:", event)
179
  try:
180
  api.upload_file(
181
  repo_id=USAGE_DATASET_REPO,
182
  repo_type="dataset",
183
  path_in_repo=USAGE_JSONL_PATH,
184
+ path_or_fileobj=BytesIO(new_content.encode("utf-8")),
185
  commit_message="append visit log",
186
+ )
187
  except Exception:
188
  pass
189