davidberenstein1957 commited on
Commit
9fa4df6
·
1 Parent(s): 5cac937

fix: change file opening mode to append for metadata file in generate_images function

Browse files
Files changed (1) hide show
  1. sample.py +2 -2
sample.py CHANGED
@@ -33,7 +33,7 @@ def generate_images(api_type: str, benchmarks: List[str]):
33
  entry = json.loads(line)
34
  existing_metadata[entry["filepath"]] = entry
35
 
36
- with open(metadata_file, "w") as f:
37
  for metadata, folder_name in tqdm(
38
  benchmark,
39
  desc=f"Generating images for {benchmark_type}",
@@ -78,7 +78,7 @@ def generate_images(api_type: str, benchmarks: List[str]):
78
  entry = json.loads(line)
79
  existing_metadata[entry["filepath"]] = entry
80
 
81
- with open(metadata_file, "w") as f:
82
  for prompt, image_path in tqdm(
83
  benchmark,
84
  desc=f"Generating images for {benchmark_type}",
 
33
  entry = json.loads(line)
34
  existing_metadata[entry["filepath"]] = entry
35
 
36
+ with open(metadata_file, "a") as f:
37
  for metadata, folder_name in tqdm(
38
  benchmark,
39
  desc=f"Generating images for {benchmark_type}",
 
78
  entry = json.loads(line)
79
  existing_metadata[entry["filepath"]] = entry
80
 
81
+ with open(metadata_file, "a") as f:
82
  for prompt, image_path in tqdm(
83
  benchmark,
84
  desc=f"Generating images for {benchmark_type}",