Siderbar slider cant handle more than 8 digit inputs #3206

I’m trying to have a slider that has more than 8 digits, but if I do it will freeze the website and never load the input

I run the code with


Code snippet:

slider = st.sidebar.slider('AidAmount_mean', 0, 123456789, 5)

Should load just fine as it supports doubles and ints

Every time I try to add a number bigger than 8 (even 7 struggles), when I load the site it will freeze for a minute and then never load the slider

  • Streamlit version: version 0.81.0
  • Python version: Python 3.9.2
  • Using pip
  • OS version: Windows 10
  • Browser version: Happens in every browser

YsAdnGh 1

Full code:

import pandas as pd
import streamlit as st

# NY Crime Prediction App

st.sidebar.header('User Input Parameters')

def user_input_features():

    AidAmount_mean = st.sidebar.slider('AidAmount_mean', 0, 1234567, 5)
    CrimesReported_mean = st.sidebar.slider('CrimesReported_mean', 0, 50562, 9340)
    data = {'AidAmount_mean': AidAmount_mean,
            'CrimesReported_mean': CrimesReported_mean}
    features = pd.DataFrame(data, index=[0])
    return features

df = user_input_features()

st.subheader('User Input parameters')

Hi @smalbec, welcome to the Streamlit forum!

It’s important to note that this operation effectively passes an array to JavaScript with millions of elements, since you are trying to go from 0 to 123 million in multiples of 5. It’s not surprising to me that this would make the browser have issues.

Is the user experience really important to have multiples of 5 with that large of a range? Feels like 1000 at minimum would be a reasonable step size (but of course, I don’t know your data).



I tried increasing the step and it worked perfectly, thank you! I’m sorry, this was due to my lack of reading the documentation. Great application btw, love how simple it makes publishing ML models.