Hi,
In my application I present a simple square image with python Pillow library. The idea is to have the slider change the image, so that when it’s at 0 the image is white and if it’s at 100, the image is black, with shades of grey inbetween accordingly. My initial solution was the following:
import streamlit as st
from PIL import Image
sliderVal = st.slider("Choose the color", max_value = 100)
compBox = Image.new('L', (100, 100), (int(sliderVal*2.55)))
st.image(compBox)
But this is painfully slow as it seems that every time the value is updated the whole page is rerunning? I need a seamless transition. I’ve seen that there are ways to improve slider functionality using the st.cache component, but I don’t really understand how to use it in my particular case. Do I need to use the slider in a function?
Would be very thankful about some pointers in the right direction.