UnboundLocalError: cannot access local variable 'text' where it is not associated with a value

I am getting this error. Please help

File β€œD:\STUDY\Semester 6\Capstone Project\main.py”, line 50, in main
chunks = text_splitter.split_text(text=text)

File β€œD:\STUDY\Semester 6\Capstone Project\main.py”, line 67, in
main()

File β€œD:\STUDY\Semester 6\Capstone Project.venv\Lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py”, line 534, in _run_script
exec(code, module.dict)

python version - 3.11.5
streamlit verison - 1.18.1

For a more effective way to communicate your questions on the Streamlit forum, I recommend referring to the thread Using Streamlit: How to Post a Question Effectively. This resource is specifically designed to help you articulate your queries in a clear and concise manner, ensuring that you receive accurate and helpful responses from the community.