ydshieh HF Staff commited on
Commit
b2686d7
Β·
verified Β·
1 Parent(s): d66c1e7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -16
app.py CHANGED
@@ -419,6 +419,7 @@ def query(repo: str, pr: str, sha: str) -> Tuple[
419
  str, # pytest_commands
420
  str, # raw_json
421
  str, # status
 
422
  ]:
423
  repo = repo.strip()
424
  pr = pr.strip()
@@ -434,7 +435,8 @@ def query(repo: str, pr: str, sha: str) -> Tuple[
434
  "",
435
  "",
436
  json.dumps({"error": "PR number is required."}, indent=2),
437
- "❌ Provide a PR number to search."
 
438
  )
439
 
440
  records = _filter_records(repo, pr, sha)
@@ -448,11 +450,23 @@ def query(repo: str, pr: str, sha: str) -> Tuple[
448
  "",
449
  "",
450
  json.dumps({"error": "No records found."}, indent=2),
451
- f"❌ No records found for PR {pr}."
 
452
  )
453
 
454
  # Use the latest record
455
  latest_record = records[0]
 
 
 
 
 
 
 
 
 
 
 
456
  metadata = latest_record.get("metadata", {})
457
 
458
  # Generate metadata info
@@ -488,7 +502,8 @@ def query(repo: str, pr: str, sha: str) -> Tuple[
488
  markdown_summary,
489
  pytest_commands,
490
  raw_json,
491
- status
 
492
  )
493
 
494
 
@@ -598,6 +613,9 @@ with gr.Blocks(title="CircleCI Test Results Viewer") as demo:
598
  language="json",
599
  lines=20,
600
  )
 
 
 
601
 
602
  def get_url_params(request: gr.Request):
603
  """Get URL parameters from the request"""
@@ -625,7 +643,8 @@ with gr.Blocks(title="CircleCI Test Results Viewer") as demo:
625
  "",
626
  "",
627
  "",
628
- "πŸ’‘ Enter a PR number above to get started"
 
629
  )
630
 
631
  # Connect the search button
@@ -639,7 +658,8 @@ with gr.Blocks(title="CircleCI Test Results Viewer") as demo:
639
  markdown_output,
640
  pytest_output,
641
  json_view,
642
- status_md
 
643
  ]
644
  )
645
 
@@ -660,20 +680,11 @@ with gr.Blocks(title="CircleCI Test Results Viewer") as demo:
660
  markdown_output,
661
  pytest_output,
662
  json_view,
663
- status_md
 
664
  ]
665
  )
666
 
667
- gr.Markdown(
668
- """
669
- ---
670
-
671
- **Data source:** [https://huggingface.co/datasets/transformers-community/circleci-test-results/blob/main/pr-42240/sha-50947fc72be7/failure_summary.json](https://huggingface.co/datasets/transformers-community/circleci-test-results/blob/main/pr-42240/sha-50947fc72be7/failure_summary.json)
672
-
673
- Files are organized as `pr-{PR}/sha-{COMMIT}/failure_summary.json`
674
- """
675
- )
676
-
677
  print("="*60)
678
  print("βœ“ GRADIO INTERFACE CREATED SUCCESSFULLY")
679
  print("="*60)
 
419
  str, # pytest_commands
420
  str, # raw_json
421
  str, # status
422
+ str, # data_source_link
423
  ]:
424
  repo = repo.strip()
425
  pr = pr.strip()
 
435
  "",
436
  "",
437
  json.dumps({"error": "PR number is required."}, indent=2),
438
+ "❌ Provide a PR number to search.",
439
+ ""
440
  )
441
 
442
  records = _filter_records(repo, pr, sha)
 
450
  "",
451
  "",
452
  json.dumps({"error": "No records found."}, indent=2),
453
+ f"❌ No records found for PR {pr}.",
454
+ ""
455
  )
456
 
457
  # Use the latest record
458
  latest_record = records[0]
459
+
460
+ # Generate data source link
461
+ source_path = latest_record.get("__source_path", "")
462
+ data_source_link = f"""
463
+ ---
464
+
465
+ **Data source:** [{source_path}](https://huggingface.co/datasets/{DATASET_ID}/blob/main/{source_path})
466
+
467
+ Files are organized as `pr-{{PR}}/sha-{{COMMIT}}/failure_summary.json`
468
+ """
469
+
470
  metadata = latest_record.get("metadata", {})
471
 
472
  # Generate metadata info
 
502
  markdown_summary,
503
  pytest_commands,
504
  raw_json,
505
+ status,
506
+ data_source_link
507
  )
508
 
509
 
 
613
  language="json",
614
  lines=20,
615
  )
616
+
617
+ # Dynamic data source link (replaces the hardcoded one)
618
+ data_source_md = gr.Markdown("")
619
 
620
  def get_url_params(request: gr.Request):
621
  """Get URL parameters from the request"""
 
643
  "",
644
  "",
645
  "",
646
+ "πŸ’‘ Enter a PR number above to get started",
647
+ ""
648
  )
649
 
650
  # Connect the search button
 
658
  markdown_output,
659
  pytest_output,
660
  json_view,
661
+ status_md,
662
+ data_source_md
663
  ]
664
  )
665
 
 
680
  markdown_output,
681
  pytest_output,
682
  json_view,
683
+ status_md,
684
+ data_source_md
685
  ]
686
  )
687
 
 
 
 
 
 
 
 
 
 
 
688
  print("="*60)
689
  print("βœ“ GRADIO INTERFACE CREATED SUCCESSFULLY")
690
  print("="*60)