Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update streamlit.py #3

Merged
merged 1 commit into from
Aug 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
Loading