Upload model
Browse files- prepare_dataset.py +6 -3
prepare_dataset.py
CHANGED
|
@@ -10,6 +10,7 @@ import datasets
|
|
| 10 |
import duckdb
|
| 11 |
import numpy as np
|
| 12 |
import pandas as pd
|
|
|
|
| 13 |
|
| 14 |
from .create_section_files import create_section_files
|
| 15 |
|
|
@@ -58,7 +59,7 @@ def lookup_tables(con, tables):
|
|
| 58 |
|
| 59 |
luts_dict[k]['total'] = start_idx
|
| 60 |
|
| 61 |
-
with open(
|
| 62 |
json.dump(luts_dict, file)
|
| 63 |
|
| 64 |
|
|
@@ -148,8 +149,10 @@ def prepare_dataset(physionet_dir, database_dir, num_workers=None):
|
|
| 148 |
)
|
| 149 |
|
| 150 |
# Load the table configuration:
|
| 151 |
-
|
| 152 |
-
|
|
|
|
|
|
|
| 153 |
|
| 154 |
# Create lookup tables:
|
| 155 |
lookup_tables(con, tables)
|
|
|
|
| 10 |
import duckdb
|
| 11 |
import numpy as np
|
| 12 |
import pandas as pd
|
| 13 |
+
from huggingface_hub import hf_hub_download
|
| 14 |
|
| 15 |
from .create_section_files import create_section_files
|
| 16 |
|
|
|
|
| 59 |
|
| 60 |
luts_dict[k]['total'] = start_idx
|
| 61 |
|
| 62 |
+
with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'lookup_tables.json'), 'w') as file:
|
| 63 |
json.dump(luts_dict, file)
|
| 64 |
|
| 65 |
|
|
|
|
| 149 |
)
|
| 150 |
|
| 151 |
# Load the table configuration:
|
| 152 |
+
path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'tables.json')
|
| 153 |
+
path = path if os.path.exists(path) else hf_hub_download(repo_id='aehrc/cxrmate-ed', filename='tables.json')
|
| 154 |
+
with open(path, 'r') as f:
|
| 155 |
+
tables = json.load(f)
|
| 156 |
|
| 157 |
# Create lookup tables:
|
| 158 |
lookup_tables(con, tables)
|