Spaces:
Running
Running
File size: 795 Bytes
cb5b71d |
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 enum
import streamlit as st
from core.state import Metadata
class MetadataEvent(enum.Enum):
"""Event that triggers a metadata change."""
NAME = "NAME"
DESCRIPTION = "DESCRIPTION"
URL = "URL"
LICENSE = "LICENSE"
CITATION = "CITATION"
def handle_metadata_change(event: MetadataEvent, metadata: Metadata, key: str):
if event == MetadataEvent.NAME:
metadata.name = st.session_state[key]
elif event == MetadataEvent.DESCRIPTION:
metadata.description = st.session_state[key]
elif event == MetadataEvent.LICENSE:
metadata.license = st.session_state[key]
elif event == MetadataEvent.CITATION:
metadata.citation = st.session_state[key]
elif event == MetadataEvent.URL:
metadata.url = st.session_state[key]
|