ysharma HF Staff commited on
Commit
7d74abb
·
verified ·
1 Parent(s): 42f6867

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -19,6 +19,11 @@ else:
19
  logger.warning("HF_TOKEN not found - running without authentication")
20
 
21
  DATASET_NAME = "build-small-hackathon/build-small-hackathon-registrations"
 
 
 
 
 
22
  DISCORD_INVITE = "https://discord.gg/YHECTft87Z"
23
  DISCORD_CHANNEL = "build-small-hackathon-official"
24
 
@@ -202,7 +207,7 @@ def safe_add_to_dataset(registration_data, max_retries=5, retry_delay=3):
202
  backup_timestamp = int(time.time())
203
  try:
204
  updated_dataset = Dataset.from_pandas(combined_df)
205
- backup_name = f"{DATASET_NAME}-auto-backup-{backup_timestamp}"
206
  logger.info(f"Creating backup: {backup_name}")
207
  updated_dataset.push_to_hub(backup_name, private=True)
208
  logger.info("Pushing to main dataset...")
 
19
  logger.warning("HF_TOKEN not found - running without authentication")
20
 
21
  DATASET_NAME = "build-small-hackathon/build-small-hackathon-registrations"
22
+ # Auto-backups land under the user namespace (not the org) so the org's dataset
23
+ # list isn't polluted with thousands of timestamped backup repos. The HF_TOKEN
24
+ # secret on the Space must have write access to BOTH the org dataset (above)
25
+ # and this user namespace.
26
+ BACKUP_DATASET_PREFIX = "ysharma/build-small-hackathon-registrations-auto-backup"
27
  DISCORD_INVITE = "https://discord.gg/YHECTft87Z"
28
  DISCORD_CHANNEL = "build-small-hackathon-official"
29
 
 
207
  backup_timestamp = int(time.time())
208
  try:
209
  updated_dataset = Dataset.from_pandas(combined_df)
210
+ backup_name = f"{BACKUP_DATASET_PREFIX}-{backup_timestamp}"
211
  logger.info(f"Creating backup: {backup_name}")
212
  updated_dataset.push_to_hub(backup_name, private=True)
213
  logger.info("Pushing to main dataset...")