Sathvik-kota commited on
Commit
4497c00
·
verified ·
1 Parent(s): 777e3bb

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. run_all_samples.py +3 -7
run_all_samples.py CHANGED
@@ -4,14 +4,14 @@ import json
4
  from pathlib import Path
5
 
6
  from fastapi.testclient import TestClient
7
- from app import app # import your FastAPI app
8
 
9
 
10
  # -----------------------------
11
  # 1. Paths
12
  # -----------------------------
13
  BASE_DIR = Path(__file__).parent
14
- SAMPLES_DIR = BASE_DIR / "samples" # <-- Your uploaded folder
15
  RESULTS_DIR = BASE_DIR / "results"
16
 
17
  RESULTS_DIR.mkdir(exist_ok=True)
@@ -34,13 +34,10 @@ def main():
34
  if not SAMPLES_DIR.exists():
35
  raise RuntimeError("❌ ERROR: 'samples/' folder does not exist in your Space.")
36
 
37
- client = TestClient(app)
38
 
39
  summary = {}
40
 
41
- # -----------------------------
42
- # 4. Process all sample files
43
- # -----------------------------
44
  for fp in sorted(SAMPLES_DIR.rglob("*")):
45
  if not fp.is_file() or not is_bill_file(fp):
46
  continue
@@ -86,6 +83,5 @@ def main():
86
  print(f" {fn}: {items}")
87
 
88
 
89
- # Required so FastAPI background task can call main()
90
  if __name__ == "__main__":
91
  main()
 
4
  from pathlib import Path
5
 
6
  from fastapi.testclient import TestClient
7
+ from app import app as fastapi_app # FIXED IMPORT
8
 
9
 
10
  # -----------------------------
11
  # 1. Paths
12
  # -----------------------------
13
  BASE_DIR = Path(__file__).parent
14
+ SAMPLES_DIR = BASE_DIR / "samples"
15
  RESULTS_DIR = BASE_DIR / "results"
16
 
17
  RESULTS_DIR.mkdir(exist_ok=True)
 
34
  if not SAMPLES_DIR.exists():
35
  raise RuntimeError("❌ ERROR: 'samples/' folder does not exist in your Space.")
36
 
37
+ client = TestClient(fastapi_app) # FIXED
38
 
39
  summary = {}
40
 
 
 
 
41
  for fp in sorted(SAMPLES_DIR.rglob("*")):
42
  if not fp.is_file() or not is_bill_file(fp):
43
  continue
 
83
  print(f" {fn}: {items}")
84
 
85
 
 
86
  if __name__ == "__main__":
87
  main()