'set' object not callable with st.write, any help on what to do?

  1. I’m running the app locally
TypeError: 'set' object is not callable
Traceback:

File "C:\Users\spandanjit\AppData\Local\Programs\Python\Python311\Lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 535, in _run_script
    exec(code, module.__dict__)
File "C:\Users\spandanjit\Desktop\diabetes\main_app.py", line 39, in <module>
    main()
File "C:\Users\spandanjit\Desktop\diabetes\main_app.py", line 31, in main
    diabetes_predict()
File "C:\Users\spandanjit\Desktop\diabetes\diabetes_predict.py", line 187, in diabetes_predict
    st.write(type(pred))

The part that’s causing the problem is:

    single_sample = np.array(encoded_result).reshape(1, -1)
    hist5 = pickle.load(open('models/hist5', 'rb')) 

    pred = hist5.predict(single_sample)
    st.write(type(pred))

My streamlit version is 1.30.0 and my python version is 3.11.6

image

Looks like a bug in your code, where you assigned a value to type or st.write.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.