Skip to content

Commit

Permalink
Merge pull request #3 from magicsword-io/MHaggis-patch-2
Browse files Browse the repository at this point in the history
Update streamlit.py
  • Loading branch information
josehelps authored Aug 5, 2024
2 parents 29686d0 + 4cb9735 commit 885ea8d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions bin/streamlit.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ def load_yaml_template(filename):
return default_template()
try:
with open(f'yaml/{filename}', 'r') as file:
return yaml.safe_load(file)
data = yaml.safe_load(file)
# Convert PEMetadata to dict if it's a list
if 'Details' in data and 'PEMetadata' in data['Details'] and isinstance(data['Details']['PEMetadata'], list):
data['Details']['PEMetadata'] = data['Details']['PEMetadata'][0] if data['Details']['PEMetadata'] else {}
return data
except yaml.YAMLError as e:
st.error(f"Error loading YAML file: {e}")
return default_template()
Expand Down Expand Up @@ -210,4 +214,4 @@ def handle_date(date_value, field_name):
return datetime.now().date()

if __name__ == "__main__":
main()
main()

0 comments on commit 885ea8d

Please sign in to comment.