IDKHowToCodeFr commited on
Commit
a91fa9a
·
verified ·
1 Parent(s): 47b7459

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. backend/database.py +9 -0
backend/database.py CHANGED
@@ -17,6 +17,15 @@ async def sync_from_hub():
17
  if not settings.hf_token:
18
  print("No HF_TOKEN found. Skipping sync.")
19
  return
 
 
 
 
 
 
 
 
 
20
 
21
  async with sync_lock:
22
  if time.time() - last_sync < 60:
 
17
  if not settings.hf_token:
18
  print("No HF_TOKEN found. Skipping sync.")
19
  return
20
+
21
+ try:
22
+ user_info = api.whoami(token=settings.hf_token)
23
+ username = user_info.get("name")
24
+ if username and "IDKHowToCodeFr" in settings.repo_id:
25
+ settings.repo_id = f"{username}/tinyml-logs"
26
+ except Exception as e:
27
+ print(f"Failed to fetch user info from token: {e}")
28
+
29
 
30
  async with sync_lock:
31
  if time.time() - last_sync < 60: