Streamlit turns a Python script into an interactive web application. It provides the visible interface for a local AI chatbot: users can enter a message in their browser while Python handles the application logic and communicates with the Ollama backend. section 8.1 section 8.0
Instead of writing HTML, CSS, and JavaScript yourself, you call functions such as st.title() and st.text_input(). Your Python script runs on the server; Streamlit generates the page elements and passes input from the browser back to Python. Its defaults provide a usable appearance without separate design work. section 8.1
A first interactive page
Save this as app.py: import streamlit as st st.title("Hello, Streamlit!") name = st.text_input("Enter your name") st.write(name) The title appears in the browser, and the input field supplies a value that Python can display. Streamlit reruns the script from top to bottom when a user interacts with the page. section 8.1 section 8.7
To try it locally:
- In an active Python virtual environment, install the package with pip install streamlit. Its additional dependencies are normal and stay inside that environment. section 6.4.3
- Start the app with streamlit run app.py, not python app.py. Open the local browser address shown in the terminal; save edits to reload the page, and press Ctrl-C to stop the server. section 8.2.3 section 8.7
Beyond a first page, widgets include text inputs, selection boxes, sliders, and buttons; sidebars and columns organize the layout. Streamlit suits tools, dashboards, and chatbot interfaces. It is not presented as a substitute for the specialized infrastructure needed by large social or e-commerce platforms. section 8.7 section 8.1
Figure 8.1 How Streamlit converts Python function calls into web page elements. Your Python script runs on the server, and Streamlit generates the HTML, CSS, and JavaScript that the browser displays.
Follow the diagram from a Python function call to the browser element it produces. section 8.1








