Microsoft Windows [Version 10.0.19045.3570]
(c) Microsoft Corporation. All rights reserved.
C:\Users\User>E:
E:>mkdir chatbot_project
A subdirectory or file chatbot_project already exists.
E:>cd chatbot_projectstreamlit run streamlit_app.py
The system cannot find the path specified.
E:>cd chatbot_project
E:\chatbot_project>streamlit run streamlit_app.py
āstreamlitā is not recognized as an internal or external command,
operable program or batch file.
E:\chatbot_project>.\venv\Scripts\activate
(venv) E:\chatbot_project>streamlit run streamlit_app.py
Welcome to Streamlit!
If youād like to receive helpful onboarding emails, news, offers, promotions,
and the occasional swag, please enter your email address below. Otherwise,
leave this field blank.
Notepad code
import streamlit as st
st.set_option(āserver.portā, 8502)
def main():
st.title(āChatbot UIā)
user_input = st.text_input(āEnter your message:ā)
st.button(āSendā)
How can that possibly work? By the time st.set_option('server.port', 8502) is executed, the server has already started. And you would need to change the code to make it run in a different port.
Besides, the welcome message suggest me that your streamlit is quite old. In a recent version you would get this (IP redacted):
(venv) E:\chatbot_project>streamlit run streamlit_app.py
You can now view your Streamlit app in your browser.
Local URL: http://localhost:8501
Network URL: http://xxx.xxx.xxx.xxx:8501
2023-11-17 09:40:24.250 Uncaught app exception
Traceback (most recent call last):
File "E:\chatbot_project\venv\Lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 534, in _run_script
exec(code, module.__dict__)
File "E:\chatbot_project\streamlit_app.py", line 3, in <module>
st.set_option('server.port', 8502)
File "E:\chatbot_project\venv\Lib\site-packages\streamlit\runtime\metrics_util.py", line 396, in wrapped_func
result = non_optional_func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\chatbot_project\venv\Lib\site-packages\streamlit\config.py", line 124, in set_user_option
raise StreamlitAPIException(
streamlit.errors.StreamlitAPIException: server.port cannot be set on the fly. Set as command line option, e.g. streamlit run script.py --server.port, or in config.toml instead.