turner-anderson / streamlit-cropper

A simple image cropper for Streamlit
MIT License
183 stars 28 forks source link

UnboundLocalError: local variable 'orig_file' referenced before assignment #28

Open DaloroAT opened 9 months ago

DaloroAT commented 9 months ago

Hello streamlit-cropper Developers!

I got the error UnboundLocalError: local variable 'orig_file' referenced before assignment with

st_cropper(Image.open(file), realtime_update=True, box_color='#0000FF', should_resize_image=False)

That's because the variable orig_file defined in a block with if should_resize_image: here but always used later even if should_resize_image is False and orig_file is not defined.