DecodingRaphael / unraphael

Python toolkit for unraveling image similarity with a focus on artistic practice
https://unraphael.readthedocs.io
Apache License 2.0
2 stars 1 forks source link

Preprocess page is broken in Streamlit>=1.36 #84

Open stefsmeets opened 4 weeks ago

stefsmeets commented 4 weeks ago

I get this error with the example files:

KeyError: 0
Traceback:

File "/home/stef/python/unraphael/.venv/lib/python3.12/site-packages/streamlit/runtime/scriptrunner/exec_code.py", line 85, in exec_func_with_error_handling
    result = func()
             ^^^^^^
File "/home/stef/python/unraphael/.venv/lib/python3.12/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 576, in code_to_exec
    exec(code, module.__dict__)
File "/home/stef/python/unraphael/src/unraphael/dash/pages/1_preprocess.py", line 196, in <module>
    main()
File "/home/stef/python/unraphael/src/unraphael/dash/pages/1_preprocess.py", line 184, in main
    processed_nobg, processed_mask = remove_background_widget(processed)
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/stef/python/unraphael/src/unraphael/dash/pages/1_preprocess.py", line 134, in remove_background_widget
    background_params['bgcolor'] = col1.radio(
                                   ^^^^^^^^^^^
File "/home/stef/python/unraphael/.venv/lib/python3.12/site-packages/streamlit/runtime/metrics_util.py", line 408, in wrapped_func
    result = non_optional_func(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/stef/python/unraphael/.venv/lib/python3.12/site-packages/streamlit/elements/widgets/radio.py", line 228, in radio
    return self._radio(
           ^^^^^^^^^^^^
File "/home/stef/python/unraphael/.venv/lib/python3.12/site-packages/streamlit/elements/widgets/radio.py", line 280, in _radio
    options=[str(format_func(option)) for option in opt],
                 ^^^^^^^^^^^^^^^^^^^
File "/home/stef/python/unraphael/src/unraphael/dash/pages/1_preprocess.py", line 137, in <lambda>
    format_func=lambda x: bgmap[x],
                          ~~~~~^^^

Python 3.12, Streamlit 1.37

stefsmeets commented 4 weeks ago

Seems like it still works fine in 1.35

ThijsVroegh commented 1 week ago

I installed the latest version of streamlit 1.38.0. The example files run fine. Perhaps move to 1.38.0?