Martin L (GitHub Actions) commited on
Commit
bdf9e69
·
1 Parent(s): 6774fdb

Automated deployment from GitHub (source commit: e5098b)

Browse files
Files changed (2) hide show
  1. scripts/demo.py +1 -1
  2. xournalpp_htr/xio.py +8 -2
scripts/demo.py CHANGED
@@ -23,7 +23,7 @@ SB_BUCKET_NAME = get_env_variable("SB_BUCKET_NAME")
23
  SB_SCHEMA_NAME = get_env_variable("SB_SCHEMA_NAME")
24
  SB_TABLE_NAME = get_env_variable("SB_TABLE_NAME")
25
 
26
- example_files = load_examples()
27
  print(f"Loaded {len(example_files)} example files from dataset:")
28
 
29
  # --- Image Processing Functions ---
 
23
  SB_SCHEMA_NAME = get_env_variable("SB_SCHEMA_NAME")
24
  SB_TABLE_NAME = get_env_variable("SB_TABLE_NAME")
25
 
26
+ example_files = load_examples(exclude_empty=True)
27
  print(f"Loaded {len(example_files)} example files from dataset:")
28
 
29
  # --- Image Processing Functions ---
xournalpp_htr/xio.py CHANGED
@@ -101,7 +101,7 @@ def get_temporary_filename() -> Path:
101
  return output_file_tmp_noOCR
102
 
103
 
104
- def load_examples():
105
  if not huggingface_hub_available:
106
  raise ImportError(
107
  "The `huggingface_hub` package is required to load the example data."
@@ -117,6 +117,12 @@ def load_examples():
117
  data_dir = Path(local_dir) / "data"
118
 
119
  # Collect all matching file paths recursively
120
- file_paths = [str(f) for f in data_dir.rglob("*") if f.suffix.lower() in extensions]
 
 
 
 
 
 
121
 
122
  return file_paths
 
101
  return output_file_tmp_noOCR
102
 
103
 
104
+ def load_examples(exclude_empty: bool = False):
105
  if not huggingface_hub_available:
106
  raise ImportError(
107
  "The `huggingface_hub` package is required to load the example data."
 
117
  data_dir = Path(local_dir) / "data"
118
 
119
  # Collect all matching file paths recursively
120
+ file_paths = sorted(
121
+ [str(f) for f in data_dir.rglob("*") if f.suffix.lower() in extensions]
122
+ )
123
+
124
+ # Remove empty files if requested
125
+ if exclude_empty:
126
+ file_paths = [fp for fp in file_paths if "empty" not in Path(fp).stem.lower()]
127
 
128
  return file_paths