Tuesday, February 11, 2025

Steps for run the streamlit in command prompt:

 Steps for run the streamlit in command prompt:


Step 1: Open the Command Line

Open the Command Prompt (Windows) or PowerShell.

Make sure Python is installed. Type this to check:


python --version


If it shows a version number, Python is installed. If not, install Python first.


Step 2: Go to the Folder Containing Your Python Code

Use the cd command to go to the folder where your Python file (e.g., app.py) is saved.


cd path/to/your/folder


Example:

If your file is in C:\projects\streamlit_app, type:


cd C:\projects\streamlit_app



Step 3: Run the Python Code with Streamlit

Run the file using Streamlit with the following command:


streamlit run app.py


Replace app.py with the name of your file.

If everything is correct, you’ll see output like this:



You can now view your Streamlit app in your browser.


Local URL: http://localhost:8501

Network URL: http://192.168.x.x:8501

Click on the Local URL or copy it into your web browser. Your Streamlit app will open!


Step 4: Check for Errors

If there’s an error (like "streamlit is not recognized"), it means Streamlit isn’t installed.

Install Streamlit by typing:


pip install streamlit


Then try running the file again.


Step 5: Stop the Streamlit Server

To stop the app, go back to the command line.

Press Ctrl + C.


No comments: