Spaces:
Sleeping
Sleeping
File size: 658 Bytes
439e630 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 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)))
|