I want to save a checkbox state to a json file
`widget_values = {}
def make_recording_widget(f):
"""Return a function that wraps a streamlit widget and records the
widget's values to a global dictionary.
"""
def wrapper(label, *args, **kwargs):
widget_value = f(label, *args, **kwargs)
widget_values[label] = widget_value
return widget_value
return wrapper
st.text("Lotação na unidade:")
checkbox = make_recording_widget(st.checkbox)
button = make_recording_widget(st.button)
checkbox("CGP")
checkbox("DCAF")
checkbox("SCD")
checkbox("SLPAC")
checkbox("SQV")
st.write("Valores: ", widget_values)
if st.button('Save JSON'):
open('base1.csv', 'w').write(widget_values.to_csv())`
error: