davanstrien HF Staff Claude Opus 4.5 commited on
Commit
af6fe58
·
1 Parent(s): 763c57d

Fix: Handle datasets with no README.md

Browse files

Create new DatasetCard when no existing card is found instead of failing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>

Files changed (2) hide show
  1. .beads/issues.jsonl +1 -1
  2. app.py +5 -3
.beads/issues.jsonl CHANGED
@@ -1,3 +1,3 @@
1
- {"id":"dataset-card-drafter-a69","title":"Add pending queue for datasets with viewer not ready","description":"","status":"in_progress","priority":1,"issue_type":"feature","created_at":"2025-12-15T18:00:44.18695Z","updated_at":"2025-12-15T18:00:50.025261Z"}
2
  {"id":"dataset-card-drafter-ebu","title":"Add PR deduplication logic","description":"Multiple PRs being opened for same dataset. Need to check for existing open PRs before creating new ones.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-12-15T17:43:02.474669Z","updated_at":"2025-12-15T17:48:03.770007Z","closed_at":"2025-12-15T17:48:03.770007Z","close_reason":"Added has_existing_pr() check using get_repo_discussions + improved PR description"}
3
  {"id":"dataset-card-drafter-wbd","title":"MVP implementation: WebhooksServer + DatasetCard + InferenceClient","description":"","status":"closed","priority":1,"issue_type":"feature","created_at":"2025-12-15T17:24:36.365733Z","updated_at":"2025-12-15T17:28:21.127763Z","closed_at":"2025-12-15T17:28:21.127763Z","close_reason":"MVP implemented with WebhooksServer, DatasetCard, and InferenceClient"}
 
1
+ {"id":"dataset-card-drafter-a69","title":"Add pending queue for datasets with viewer not ready","description":"","status":"closed","priority":1,"issue_type":"feature","created_at":"2025-12-15T18:00:44.18695Z","updated_at":"2025-12-15T18:06:00.964121Z","closed_at":"2025-12-15T18:06:00.964121Z","close_reason":"Added pending queue with background retry and UI tab"}
2
  {"id":"dataset-card-drafter-ebu","title":"Add PR deduplication logic","description":"Multiple PRs being opened for same dataset. Need to check for existing open PRs before creating new ones.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-12-15T17:43:02.474669Z","updated_at":"2025-12-15T17:48:03.770007Z","closed_at":"2025-12-15T17:48:03.770007Z","close_reason":"Added has_existing_pr() check using get_repo_discussions + improved PR description"}
3
  {"id":"dataset-card-drafter-wbd","title":"MVP implementation: WebhooksServer + DatasetCard + InferenceClient","description":"","status":"closed","priority":1,"issue_type":"feature","created_at":"2025-12-15T17:24:36.365733Z","updated_at":"2025-12-15T17:28:21.127763Z","closed_at":"2025-12-15T17:28:21.127763Z","close_reason":"MVP implemented with WebhooksServer, DatasetCard, and InferenceClient"}
app.py CHANGED
@@ -150,11 +150,13 @@ async def process_dataset(dataset_id: str, inference_token: str, pr_token: str)
150
  remove_from_pending(dataset_id) # Clean up if it was pending
151
  return {"status": "skipped", "reason": "open PR already exists"}
152
 
153
- # Load current card
154
  try:
155
  card = DatasetCard.load(dataset_id)
156
- except Exception as e:
157
- return {"status": "error", "reason": f"card load failed: {e}"}
 
 
158
 
159
  # Check if description needed
160
  if not should_generate(card):
 
150
  remove_from_pending(dataset_id) # Clean up if it was pending
151
  return {"status": "skipped", "reason": "open PR already exists"}
152
 
153
+ # Load current card (or create new if none exists)
154
  try:
155
  card = DatasetCard.load(dataset_id)
156
+ except Exception:
157
+ # No README exists - create a new card
158
+ card = DatasetCard("")
159
+ logger.info(f"No existing card for {dataset_id}, creating new one")
160
 
161
  # Check if description needed
162
  if not should_generate(card):