Spaces:
Sleeping
Sleeping
Download batch_run.py from Ray1ee01/ChartPipeline: direct link, hf CLI and curl.
- Browser
- Download file 658 Bytes
-
https://huggingface.co/spaces/Ray1ee01/ChartPipeline/resolve/main/batch_run.py
- Command line
-
hf download hf://spaces/Ray1ee01/ChartPipeline/batch_run.py
-
curl -L -o batch_run.py https://huggingface.co/spaces/Ray1ee01/ChartPipeline/resolve/main/batch_run.py
658 Bytes
| import json | |
| import subprocess | |
| from multiprocessing import Pool | |
| from tqdm import tqdm | |
| def run_command(item): | |
| data_source = item["data_source"] | |
| chart_variation = item["chart_variation"] | |
| cmd = [ | |
| "python", "pipeline.py", | |
| "--modules", "infographics_generator", | |
| "--input", data_source, | |
| "--output", "./test_output_new_new", | |
| "--chart-name", chart_variation | |
| ] | |
| subprocess.run(cmd) | |
| return item | |
| start_id = 0 | |
| with open("extracted_info.json", "r") as f: | |
| data = json.load(f)[start_id:start_id+1] | |
| with Pool(processes=8) as pool: | |
| list(tqdm(pool.imap(run_command, data), total=len(data))) | |