Skip to content

Commit

Permalink
Update io.py
Browse files Browse the repository at this point in the history
  • Loading branch information
0xb-s authored Jan 10, 2025
1 parent a6e2fdd commit 9f9f3e5
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions cosmos1/utils/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,13 @@ def read_prompts_from_file(prompt_file: str) -> List[Dict[str, str]]:
List[Dict[str, str]]: List of prompt dictionaries
"""
prompts = []
with open(prompt_file, "r") as f:
for line in f:
prompt_dict = json.loads(line.strip())
prompts.append(prompt_dict)
try:
with open(prompt_file, "r") as f:
for line in f:
prompt_dict = json.loads(line.strip())
prompts.append(prompt_dict)
except (FileNotFoundError, json.JSONDecodeError) as e:
raise ValueError(f"Error reading prompts file: {e}")
return prompts


Expand Down

0 comments on commit 9f9f3e5

Please sign in to comment.