Spaces:
Sleeping
Sleeping
Upload script.py
Browse files
script.py
CHANGED
|
@@ -6,7 +6,6 @@ import tqdm
|
|
| 6 |
|
| 7 |
BASE = Path(__file__).resolve().parents[0]
|
| 8 |
DATASET_DIR = BASE / "dataset"
|
| 9 |
-
GPT_DIR = BASE / "gpt"
|
| 10 |
|
| 11 |
|
| 12 |
def find_split_dir() -> Path:
|
|
@@ -22,10 +21,10 @@ def run_for_pdf(pdf_path: Path, out_path: Path) -> int:
|
|
| 22 |
out_path.parent.mkdir(parents=True, exist_ok=True)
|
| 23 |
|
| 24 |
cmd = [sys.executable, "main.py", "--pdf", str(pdf_path), "--out", str(out_path)]
|
| 25 |
-
print(f"Running: {' '.join(cmd)}
|
| 26 |
-
proc = subprocess.run(cmd,
|
| 27 |
if proc.returncode != 0:
|
| 28 |
-
print(f"ERROR:
|
| 29 |
print(proc.stdout)
|
| 30 |
print(proc.stderr)
|
| 31 |
else:
|
|
|
|
| 6 |
|
| 7 |
BASE = Path(__file__).resolve().parents[0]
|
| 8 |
DATASET_DIR = BASE / "dataset"
|
|
|
|
| 9 |
|
| 10 |
|
| 11 |
def find_split_dir() -> Path:
|
|
|
|
| 21 |
out_path.parent.mkdir(parents=True, exist_ok=True)
|
| 22 |
|
| 23 |
cmd = [sys.executable, "main.py", "--pdf", str(pdf_path), "--out", str(out_path)]
|
| 24 |
+
print(f"Running: {' '.join(cmd)}")
|
| 25 |
+
proc = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
| 26 |
if proc.returncode != 0:
|
| 27 |
+
print(f"ERROR: main.py failed for {pdf_path.name} (rc={proc.returncode})")
|
| 28 |
print(proc.stdout)
|
| 29 |
print(proc.stderr)
|
| 30 |
else:
|